Skip to content

Commit ad1886a

Browse files
committed
Fix rustdoc help message when no args are passed
1 parent dc6595d commit ad1886a

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

scripts/rustc-clif.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ fn main() {
2626
codegen_backend_arg.push(cg_clif_dylib_path);
2727
args.push(codegen_backend_arg);
2828
}
29-
if !passed_args.iter().any(|arg| {
30-
arg == "--sysroot" || arg.to_str().is_some_and(|s| s.starts_with("--sysroot="))
31-
}) {
29+
if !passed_args
30+
.iter()
31+
.any(|arg| arg == "--sysroot" || arg.to_str().is_some_and(|s| s.starts_with("--sysroot=")))
32+
{
3233
args.push(OsString::from("--sysroot"));
3334
args.push(OsString::from(sysroot.to_str().unwrap()));
3435
}

scripts/rustdoc-clif.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,18 @@ fn main() {
2626
codegen_backend_arg.push(cg_clif_dylib_path);
2727
args.push(codegen_backend_arg);
2828
}
29-
if !passed_args.iter().any(|arg| {
30-
arg == "--sysroot" || arg.to_str().is_some_and(|s| s.starts_with("--sysroot="))
31-
}) {
29+
if !passed_args
30+
.iter()
31+
.any(|arg| arg == "--sysroot" || arg.to_str().is_some_and(|s| s.starts_with("--sysroot=")))
32+
{
3233
args.push(OsString::from("--sysroot"));
3334
args.push(OsString::from(sysroot.to_str().unwrap()));
3435
}
36+
if passed_args.is_empty() {
37+
// Don't pass any arguments when the user didn't pass any arguments
38+
// either to ensure the help message is shown.
39+
args.clear();
40+
}
3541
args.extend(passed_args);
3642

3743
let rustdoc = if let Some(rustdoc) = option_env!("RUSTDOC") {

scripts/test_rustc_tests.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,6 @@ rm tests/ui/mir/mir_raw_fat_ptr.rs # same
9999
rm tests/ui/consts/issue-33537.rs # same
100100
rm tests/ui/consts/const-mut-refs-crate.rs # same
101101

102-
# rustdoc-clif passes extra args, suppressing the help message when no args are passed
103-
rm -r tests/run-make/issue-88756-default-output
104-
105102
# doesn't work due to the way the rustc test suite is invoked.
106103
# should work when using ./x.py test the way it is intended
107104
# ============================================================

0 commit comments

Comments
 (0)