about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/bin/rustc.rs2
-rw-r--r--src/bootstrap/builder.rs15
-rw-r--r--src/bootstrap/compile.rs1
-rw-r--r--src/bootstrap/test.rs25
-rw-r--r--src/tools/compiletest/src/common.rs4
-rw-r--r--src/tools/compiletest/src/runtest.rs3
-rw-r--r--src/tools/tidy/src/ui_tests.rs2
7 files changed, 43 insertions, 9 deletions
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs
index 040fec3615b..dd86634b47c 100644
--- a/src/bootstrap/bin/rustc.rs
+++ b/src/bootstrap/bin/rustc.rs
@@ -150,7 +150,7 @@ fn main() {
     // allow the `rustc_private` feature to link to other unstable crates
     // also in the sysroot. We also do this for host crates, since those
     // may be proc macros, in which case we might ship them.
-    if env::var_os("RUSTC_FORCE_UNSTABLE").is_some() && (stage != "0" || target.is_some()) {
+    if env::var_os("RUSTC_FORCE_UNSTABLE").is_some() {
         cmd.arg("-Z").arg("force-unstable-if-unmarked");
     }
 
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 4977ce22724..9666874d0fe 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -1008,9 +1008,24 @@ impl<'a> Builder<'a> {
                 // Avoid deleting the rustlib/ directory we just copied
                 // (in `impl Step for Sysroot`).
                 if !builder.download_rustc() {
+                    builder.verbose(&format!(
+                        "Removing sysroot {} to avoid caching bugs",
+                        sysroot.display()
+                    ));
                     let _ = fs::remove_dir_all(&sysroot);
                     t!(fs::create_dir_all(&sysroot));
                 }
+
+                if self.compiler.stage == 0 {
+                    // The stage 0 compiler for the build triple is always pre-built.
+                    // Ensure that `libLLVM.so` ends up in the target libdir, so that ui-fulldeps tests can use it when run.
+                    dist::maybe_install_llvm_target(
+                        builder,
+                        self.compiler.host,
+                        &builder.sysroot(self.compiler),
+                    );
+                }
+
                 INTERNER.intern_path(sysroot)
             }
         }
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index 4a4e7adcbf3..1573134e35f 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -1260,6 +1260,7 @@ impl Step for Sysroot {
         };
         let sysroot = sysroot_dir(compiler.stage);
 
+        builder.verbose(&format!("Removing sysroot {} to avoid caching bugs", sysroot.display()));
         let _ = fs::remove_dir_all(&sysroot);
         t!(fs::create_dir_all(&sysroot));
 
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index 3814dc63ed4..ccf83974b8c 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -1448,7 +1448,7 @@ note: if you're sure you want to do this, please open an issue as to why. In the
             crate::detail_exit(1);
         }
 
-        let compiler = self.compiler;
+        let mut compiler = self.compiler;
         let target = self.target;
         let mode = self.mode;
         let suite = self.suite;
@@ -1461,15 +1461,28 @@ note: if you're sure you want to do this, please open an issue as to why. In the
             return;
         }
 
-        if suite == "debuginfo" {
-            builder
-                .ensure(dist::DebuggerScripts { sysroot: builder.sysroot(compiler), host: target });
-        }
+        // Support stage 1 ui-fulldeps. This is somewhat complicated: ui-fulldeps tests for the most
+        // part test the *API* of the compiler, not how it compiles a given file. As a result, we
+        // can run them against the stage 1 sources as long as we build them with the stage 0
+        // bootstrap compiler.
+        // NOTE: Only stage 1 is special cased because we need the rustc_private artifacts to match the
+        // running compiler in stage 2 when plugins run.
+        let stage_id = if suite == "ui-fulldeps" && compiler.stage == 1 {
+            compiler = builder.compiler(compiler.stage - 1, target);
+            format!("stage{}-{}", compiler.stage + 1, target)
+        } else {
+            format!("stage{}-{}", compiler.stage, target)
+        };
 
         if suite.ends_with("fulldeps") {
             builder.ensure(compile::Rustc::new(compiler, target));
         }
 
+        if suite == "debuginfo" {
+            builder
+                .ensure(dist::DebuggerScripts { sysroot: builder.sysroot(compiler), host: target });
+        }
+
         builder.ensure(compile::Std::new(compiler, target));
         // ensure that `libproc_macro` is available on the host.
         builder.ensure(compile::Std::new(compiler, compiler.host));
@@ -1528,7 +1541,7 @@ note: if you're sure you want to do this, please open an issue as to why. In the
         cmd.arg("--src-base").arg(builder.src.join("tests").join(suite));
         cmd.arg("--build-base").arg(testdir(builder, compiler.host).join(suite));
         cmd.arg("--sysroot-base").arg(builder.sysroot(compiler));
-        cmd.arg("--stage-id").arg(format!("stage{}-{}", compiler.stage, target));
+        cmd.arg("--stage-id").arg(stage_id);
         cmd.arg("--suite").arg(suite);
         cmd.arg("--mode").arg(mode);
         cmd.arg("--target").arg(target.rustc_target_arg());
diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs
index 3f36cc5bbcc..7166d99d792 100644
--- a/src/tools/compiletest/src/common.rs
+++ b/src/tools/compiletest/src/common.rs
@@ -422,7 +422,9 @@ pub struct TargetCfgs {
 
 impl TargetCfgs {
     fn new(config: &Config) -> TargetCfgs {
-        let targets: HashMap<String, TargetCfg> = if config.stage_id.starts_with("stage0-") {
+        let targets: HashMap<String, TargetCfg> = if config.stage_id.starts_with("stage0-")
+            || (config.suite == "ui-fulldeps" && config.stage_id.starts_with("stage1-"))
+        {
             // #[cfg(bootstrap)]
             // Needed only for one cycle, remove during the bootstrap bump.
             Self::collect_all_slow(config)
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 0fa5c54ae8e..1a4e9b58383 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1900,6 +1900,9 @@ impl<'test> TestCx<'test> {
         // Use a single thread for efficiency and a deterministic error message order
         rustc.arg("-Zthreads=1");
 
+        // In stage 0, make sure we use `stage0-sysroot` instead of the bootstrap sysroot.
+        rustc.arg("--sysroot").arg(&self.config.sysroot_base);
+
         // Optionally prevent default --target if specified in test compile-flags.
         let custom_target = self.props.compile_flags.iter().any(|x| x.starts_with("--target"));
 
diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs
index 29664c854c8..b1385edf13e 100644
--- a/src/tools/tidy/src/ui_tests.rs
+++ b/src/tools/tidy/src/ui_tests.rs
@@ -9,7 +9,7 @@ use std::path::{Path, PathBuf};
 
 // FIXME: The following limits should be reduced eventually.
 const ENTRY_LIMIT: usize = 885;
-const ROOT_ENTRY_LIMIT: usize = 891;
+const ROOT_ENTRY_LIMIT: usize = 894;
 const ISSUES_ENTRY_LIMIT: usize = 1977;
 
 fn check_entries(tests_path: &Path, bad: &mut bool) {