diff --git a/scripts/rustc-clif.rs b/scripts/rustc-clif.rs index ab496a4a684..7ef3488672d 100644 --- a/scripts/rustc-clif.rs +++ b/scripts/rustc-clif.rs @@ -22,7 +22,9 @@ fn main() { let mut codegen_backend_arg = OsString::from("-Zcodegen-backend="); codegen_backend_arg.push(cg_clif_dylib_path); args.push(codegen_backend_arg); - if !passed_args.contains(&OsString::from("--sysroot")) { + if !passed_args.iter().any(|arg| { + arg == "--sysroot" || arg.to_str().map(|s| s.starts_with("--sysroot=")) == Some(true) + }) { 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 545844446c5..72024e0d494 100644 --- a/scripts/rustdoc-clif.rs +++ b/scripts/rustdoc-clif.rs @@ -22,7 +22,9 @@ fn main() { let mut codegen_backend_arg = OsString::from("-Zcodegen-backend="); codegen_backend_arg.push(cg_clif_dylib_path); args.push(codegen_backend_arg); - if !passed_args.contains(&OsString::from("--sysroot")) { + if !passed_args.iter().any(|arg| { + arg == "--sysroot" || arg.to_str().map(|s| s.starts_with("--sysroot=")) == Some(true) + }) { args.push(OsString::from("--sysroot")); args.push(OsString::from(sysroot.to_str().unwrap())); }