Skip to content

Instantly share code, notes, and snippets.

@jyn514
Created May 26, 2023 01:18
Show Gist options
  • Save jyn514/c491585c45c1a77d255fb9f2d7bf4e1a to your computer and use it in GitHub Desktop.
Save jyn514/c491585c45c1a77d255fb9f2d7bf4e1a to your computer and use it in GitHub Desktop.
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 5bc4d164265..211d45e022e 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1939,6 +1939,17 @@ fn make_compile_args(
// Use a single thread for efficiency and a deterministic error message order
rustc.arg("-Zthreads=1");
+ // Hide libstd sources from ui tests to make sure we generate the stderr
+ // output that users will see.
+ // Without this, we may be producing good diagnostics in-tree but users
+ // will not see half the information.
+ //
+ // This also has the benefit of more effectively normalizing output between different
+ // compilers, so that we don't have to know the `/rustc/$sha` output to normalize after the
+ // fact.
+ rustc.arg("-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX");
+ rustc.arg("-Ztranslate-remapped-path-to-local-path=no");
+
// Optionally prevent default --sysroot if specified in test compile-flags.
if !self.props.compile_flags.iter().any(|flag| flag.starts_with("--sysroot")) {
// In stage 0, make sure we use `stage0-sysroot` instead of the bootstrap sysroot.
@@ -2014,13 +2025,6 @@ fn make_compile_args(
rustc.arg("-Ccodegen-units=1");
// Hide line numbers to reduce churn
rustc.arg("-Zui-testing");
- // Hide libstd sources from ui tests to make sure we generate the stderr
- // output that users will see.
- // Without this, we may be producing good diagnostics in-tree but users
- // will not see half the information.
- rustc.arg("-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX");
- rustc.arg("-Ztranslate-remapped-path-to-local-path=no");
-
rustc.arg("-Zdeduplicate-diagnostics=no");
// FIXME: use this for other modes too, for perf?
rustc.arg("-Cstrip=debuginfo");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment