about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPhilipp Krones <hello@philkrones.com>2023-01-12 19:48:13 +0100
committerPhilipp Krones <hello@philkrones.com>2023-01-12 19:48:13 +0100
commitd21616737b56681fdf19cdf9a9f8db16d0e87961 (patch)
tree657994927fb5985d32feeddcf5e1204c5952b4f6 /src
parent5f8686ec3b598ca33b64c6e1cd31f72214b49e96 (diff)
downloadrust-d21616737b56681fdf19cdf9a9f8db16d0e87961.tar.gz
rust-d21616737b56681fdf19cdf9a9f8db16d0e87961.zip
Merge commit '7f27e2e74ef957baa382dc05cf08df6368165c74' into clippyup
Diffstat (limited to 'src')
-rw-r--r--src/driver.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/driver.rs b/src/driver.rs
index bcc096c570e..d521e8d8839 100644
--- a/src/driver.rs
+++ b/src/driver.rs
@@ -256,11 +256,14 @@ pub fn main() {
     LazyLock::force(&ICE_HOOK);
     exit(rustc_driver::catch_with_exit_code(move || {
         let mut orig_args: Vec<String> = env::args().collect();
+        let has_sysroot_arg = arg_value(&orig_args, "--sysroot", |_| true).is_some();
 
         let sys_root_env = std::env::var("SYSROOT").ok();
         let pass_sysroot_env_if_given = |args: &mut Vec<String>, sys_root_env| {
             if let Some(sys_root) = sys_root_env {
-                args.extend(vec!["--sysroot".into(), sys_root]);
+                if !has_sysroot_arg {
+                    args.extend(vec!["--sysroot".into(), sys_root]);
+                }
             };
         };