]> git.lizzy.rs Git - rust.git/commitdiff
Rust bootstrap sysroot now has src in the same place as rust-src, so remove special...
authorRalf Jung <post@ralfj.de>
Sat, 4 Apr 2020 10:07:22 +0000 (12:07 +0200)
committerRalf Jung <post@ralfj.de>
Sat, 4 Apr 2020 10:07:22 +0000 (12:07 +0200)
rust-version
src/bin/cargo-miri.rs

index e3dc200835fde2aa099b8e4662a8c0845af2f743..895cbb5fa9a0184a1456d58d7efa8018b30f8a48 100644 (file)
@@ -1 +1 @@
-537ccdf3ac44c8c7a8d36cbdbe6fb224afabb7ae
+6050e523bae6de61de4e060facc43dc512adaccd
index 9ef4996992a430fa840d92524a968903f4c0c1bf..083918de0f3a0469d9daceca2acc76e858780bdf 100644 (file)
@@ -301,34 +301,19 @@ fn setup(ask_user: bool) {
                 .stdout;
             let sysroot = std::str::from_utf8(&sysroot).unwrap();
             let sysroot = Path::new(sysroot.trim_end_matches('\n'));
-            // First try: `$SYSROOT/lib/rustlib/src/rust`; test if that contains `Cargo.lock`.
-            let rustup_src = sysroot.join("lib").join("rustlib").join("src").join("rust");
-            let base_dir = if rustup_src.join("Cargo.lock").exists() {
-                // Just use this.
-                rustup_src
-            } else {
-                // Maybe this is a local toolchain built with `x.py` and linked into `rustup`?
-                // Second try: `$SYSROOT/../../..`; test if that contains `x.py`.
-                let local_src = sysroot.parent().and_then(Path::parent).and_then(Path::parent);
-                match local_src {
-                    Some(local_src) if local_src.join("x.py").exists() => {
-                        // Use this.
-                        PathBuf::from(local_src)
-                    }
-                    _ => {
-                        // Fallback: Ask the user to install the `rust-src` component, and use that.
-                        let mut cmd = Command::new("rustup");
-                        cmd.args(&["component", "add", "rust-src"]);
-                        ask_to_run(
-                            cmd,
-                            ask_user,
-                            "install the rustc-src component for the selected toolchain",
-                        );
-                        rustup_src
-                    }
-                }
-            };
-            base_dir.join("src") // Xargo wants the src-subdir
+            // Check for `$SYSROOT/lib/rustlib/src/rust/src`; test if that contains `libstd/lib.rs`.
+            let rustup_src = sysroot.join("lib").join("rustlib").join("src").join("rust").join("src");
+            if !rustup_src.join("libstd").join("lib.rs").exists() {
+                // Ask the user to install the `rust-src` component, and use that.
+                let mut cmd = Command::new("rustup");
+                cmd.args(&["component", "add", "rust-src"]);
+                ask_to_run(
+                    cmd,
+                    ask_user,
+                    "install the rustc-src component for the selected toolchain",
+                );
+            }
+            rustup_src
         }
     };
     if !rust_src.exists() {