diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2024-03-26 10:27:19 +0000 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2024-03-26 10:27:19 +0000 |
| commit | ad1886a5f0a6a56e9ee9c22ca80e1bcd27d4edd8 (patch) | |
| tree | 095ee15778db335f7d41bfccc53e4af2825082e3 /scripts | |
| parent | dc6595ddbc94173289092d653215e4add8c666e2 (diff) | |
| download | rust-ad1886a5f0a6a56e9ee9c22ca80e1bcd27d4edd8.tar.gz rust-ad1886a5f0a6a56e9ee9c22ca80e1bcd27d4edd8.zip | |
Fix rustdoc help message when no args are passed
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/rustc-clif.rs | 7 | ||||
| -rw-r--r-- | scripts/rustdoc-clif.rs | 12 | ||||
| -rwxr-xr-x | scripts/test_rustc_tests.sh | 3 |
3 files changed, 13 insertions, 9 deletions
diff --git a/scripts/rustc-clif.rs b/scripts/rustc-clif.rs index 550f2051553..92defd21cd9 100644 --- a/scripts/rustc-clif.rs +++ b/scripts/rustc-clif.rs @@ -26,9 +26,10 @@ fn main() { codegen_backend_arg.push(cg_clif_dylib_path); args.push(codegen_backend_arg); } - if !passed_args.iter().any(|arg| { - arg == "--sysroot" || arg.to_str().is_some_and(|s| s.starts_with("--sysroot=")) - }) { + if !passed_args + .iter() + .any(|arg| arg == "--sysroot" || arg.to_str().is_some_and(|s| s.starts_with("--sysroot="))) + { args.push(OsString::from("--sysroot")); args.push(OsString::from(sysroot.to_str().unwrap())); } diff --git a/scripts/rustdoc-clif.rs b/scripts/rustdoc-clif.rs index f7d1bdbc4c6..1cad312bb79 100644 --- a/scripts/rustdoc-clif.rs +++ b/scripts/rustdoc-clif.rs @@ -26,12 +26,18 @@ fn main() { codegen_backend_arg.push(cg_clif_dylib_path); args.push(codegen_backend_arg); } - if !passed_args.iter().any(|arg| { - arg == "--sysroot" || arg.to_str().is_some_and(|s| s.starts_with("--sysroot=")) - }) { + if !passed_args + .iter() + .any(|arg| arg == "--sysroot" || arg.to_str().is_some_and(|s| s.starts_with("--sysroot="))) + { args.push(OsString::from("--sysroot")); args.push(OsString::from(sysroot.to_str().unwrap())); } + if passed_args.is_empty() { + // Don't pass any arguments when the user didn't pass any arguments + // either to ensure the help message is shown. + args.clear(); + } args.extend(passed_args); let rustdoc = if let Some(rustdoc) = option_env!("RUSTDOC") { diff --git a/scripts/test_rustc_tests.sh b/scripts/test_rustc_tests.sh index 63f4ef9464a..a6f25c3f819 100755 --- a/scripts/test_rustc_tests.sh +++ b/scripts/test_rustc_tests.sh @@ -99,9 +99,6 @@ rm tests/ui/mir/mir_raw_fat_ptr.rs # same rm tests/ui/consts/issue-33537.rs # same rm tests/ui/consts/const-mut-refs-crate.rs # same -# rustdoc-clif passes extra args, suppressing the help message when no args are passed -rm -r tests/run-make/issue-88756-default-output - # doesn't work due to the way the rustc test suite is invoked. # should work when using ./x.py test the way it is intended # ============================================================ |
