about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-11-25 22:00:08 +0000
committerbors <bors@rust-lang.org>2018-11-25 22:00:08 +0000
commitc14ab13e618958bcb353b4e3c2eb2228475aa1ab (patch)
tree17bdd52c19dabf789443262d04c4ec699afe02d9 /src
parent6acbb5b65c06d82c867a94c54ce51dab4707ac61 (diff)
parent6aa4eb923f83112867a043726d04b81107bb9241 (diff)
downloadrust-c14ab13e618958bcb353b4e3c2eb2228475aa1ab.tar.gz
rust-c14ab13e618958bcb353b4e3c2eb2228475aa1ab.zip
Auto merge of #56194 - eddyb:top-unhack, r=alexcrichton
Try to make top-level Cargo.toml work without __CARGO_TEST_ROOT.

The last failures I noticed before adding the `__CARGO_TEST_ROOT` hack were in `src/test/run-make/thumb-none-{cortex-m,qemu}`, and had to do with the fact that the top-level `Cargo.toml` uses nightly Cargo features.

If that's the only problem, this PR should work, and we can figure out how to unbreak RLS.
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/test.rs1
-rw-r--r--src/bootstrap/tool.rs20
-rw-r--r--src/test/run-make/thumb-none-cortex-m/Makefile5
-rw-r--r--src/test/run-make/thumb-none-qemu/script.sh7
4 files changed, 11 insertions, 22 deletions
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index c50e6a27033..e55773011df 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -1934,7 +1934,6 @@ impl Step for Distcheck {
                 .arg("generate-lockfile")
                 .arg("--manifest-path")
                 .arg(&toml)
-                .env("__CARGO_TEST_ROOT", &dir)
                 .current_dir(&dir),
         );
     }
diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index 4acc739db57..58c5296beb3 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
@@ -264,7 +264,6 @@ macro_rules! tool {
         $name:ident, $path:expr, $tool_name:expr, $mode:expr
         $(,llvm_tools = $llvm:expr)*
         $(,is_external_tool = $external:expr)*
-        $(,cargo_test_root = $cargo_test_root:expr)*
         ;
     )+) => {
         #[derive(Copy, PartialEq, Eq, Clone)]
@@ -288,15 +287,6 @@ macro_rules! tool {
                     $(Tool::$name => false $(|| $llvm)*,)+
                 }
             }
-
-            /// Whether this tool requires may run Cargo for test crates,
-            /// which currently needs setting the environment variable
-            /// `__CARGO_TEST_ROOT` to separate it from the workspace.
-            pub fn needs_cargo_test_root(&self) -> bool {
-                match self {
-                    $(Tool::$name => false $(|| $cargo_test_root)*,)+
-                }
-            }
         }
 
         impl<'a> Builder<'a> {
@@ -372,9 +362,8 @@ tool!(
     UnstableBookGen, "src/tools/unstable-book-gen", "unstable-book-gen", Mode::ToolBootstrap;
     Tidy, "src/tools/tidy", "tidy", Mode::ToolBootstrap;
     Linkchecker, "src/tools/linkchecker", "linkchecker", Mode::ToolBootstrap;
-    CargoTest, "src/tools/cargotest", "cargotest", Mode::ToolBootstrap, cargo_test_root = true;
-    Compiletest, "src/tools/compiletest", "compiletest", Mode::ToolBootstrap,
-        llvm_tools = true, cargo_test_root = true;
+    CargoTest, "src/tools/cargotest", "cargotest", Mode::ToolBootstrap;
+    Compiletest, "src/tools/compiletest", "compiletest", Mode::ToolBootstrap, llvm_tools = true;
     BuildManifest, "src/tools/build-manifest", "build-manifest", Mode::ToolBootstrap;
     RemoteTestClient, "src/tools/remote-test-client", "remote-test-client", Mode::ToolBootstrap;
     RustInstaller, "src/tools/rust-installer", "fabricate", Mode::ToolBootstrap,
@@ -693,11 +682,6 @@ impl<'a> Builder<'a> {
             }
         }
 
-        // Set `__CARGO_TEST_ROOT` to the build directory if needed.
-        if tool.needs_cargo_test_root() {
-            cmd.env("__CARGO_TEST_ROOT", &self.config.out);
-        }
-
         add_lib_path(lib_paths, cmd);
     }
 
diff --git a/src/test/run-make/thumb-none-cortex-m/Makefile b/src/test/run-make/thumb-none-cortex-m/Makefile
index 741bce921e6..819439069ea 100644
--- a/src/test/run-make/thumb-none-cortex-m/Makefile
+++ b/src/test/run-make/thumb-none-cortex-m/Makefile
@@ -32,7 +32,10 @@ all:
 	mkdir -p $(WORK_DIR)
 	-cd $(WORK_DIR) && rm -rf $(CRATE)
 	cd $(WORK_DIR) && bash -x $(HERE)/../git_clone_sha1.sh $(CRATE) $(CRATE_URL) $(CRATE_SHA1)
-	cd $(WORK_DIR) && cd $(CRATE) && $(CARGO) build --target $(TARGET) -v
+	# HACK(eddyb) sets `RUSTC_BOOTSTRAP=1` so Cargo can accept nightly features.
+	# These come from the top-level Rust workspace, that this crate is not a
+	# member of, but Cargo tries to load the workspace `Cargo.toml` anyway.
+	cd $(WORK_DIR) && cd $(CRATE) && env RUSTC_BOOTSTRAP=1 $(CARGO) build --target $(TARGET) -v
 else
 
 all:
diff --git a/src/test/run-make/thumb-none-qemu/script.sh b/src/test/run-make/thumb-none-qemu/script.sh
index 0f1c49f3a71..c5cbff5c3c3 100644
--- a/src/test/run-make/thumb-none-qemu/script.sh
+++ b/src/test/run-make/thumb-none-qemu/script.sh
@@ -8,9 +8,12 @@ pushd $WORK_DIR
     rm -rf $CRATE || echo OK
     cp -a $HERE/example .
     pushd $CRATE
-        env RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" \
+        # HACK(eddyb) sets `RUSTC_BOOTSTRAP=1` so Cargo can accept nightly features.
+        # These come from the top-level Rust workspace, that this crate is not a
+        # member of, but Cargo tries to load the workspace `Cargo.toml` anyway.
+        env RUSTC_BOOTSTRAP=1 RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" \
             $CARGO run --target $TARGET           | grep "x = 42"
-        env RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" \
+        env RUSTC_BOOTSTRAP=1 RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" \
             $CARGO run --target $TARGET --release | grep "x = 42"
     popd
 popd