diff options
| author | Urgau <3616612+Urgau@users.noreply.github.com> | 2025-06-18 19:40:32 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-18 19:40:32 +0200 |
| commit | bf38e5dee3608d68f95eb34864192e8b6b6597c0 (patch) | |
| tree | 6ae6890f5a00d60b67ffebcb82d8f175e8b521cb /src/tools/compiletest | |
| parent | 2011ab51528ba9469ba313ff3c269b465d042f1d (diff) | |
| parent | 268fbfed477a20cb7efa04b8c28982f46f16a4a4 (diff) | |
| download | rust-bf38e5dee3608d68f95eb34864192e8b6b6597c0.tar.gz rust-bf38e5dee3608d68f95eb34864192e8b6b6597c0.zip | |
Rollup merge of #142377 - Urgau:unremap-rustc-dev, r=jieyouxu
Try unremapping compiler sources See [#t-compiler/help > Span pointing to wrong file location (`rustc-dev` component)](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/Span.20pointing.20to.20wrong.20file.20location.20.28.60rustc-dev.60.20component.29/with/521087083). This PR is a follow-up to rust-lang/rust#141751 regarding the compiler side. Specifically we now take into account the `CFG_VIRTUAL_RUSTC_DEV_SOURCE_BASE_DIR` env from rust-lang/rust#141751 when trying to unremap sources from `$sysroot/lib/rustlib/rustc-src/rust` (the `rustc-dev` component install directory). Best reviewed commit by commit. cc ``@samueltardieu`` r? ``@jieyouxu``
Diffstat (limited to 'src/tools/compiletest')
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 75f24adb70f..9edcba5d460 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2371,6 +2371,12 @@ impl<'test> TestCx<'test> { let rust_src_dir = rust_src_dir.read_link_utf8().unwrap_or(rust_src_dir.to_path_buf()); normalize_path(&rust_src_dir.join("library"), "$SRC_DIR_REAL"); + // Real paths into the compiler + let rustc_src_dir = &self.config.sysroot_base.join("lib/rustlib/rustc-src/rust"); + rustc_src_dir.try_exists().expect(&*format!("{} should exists", rustc_src_dir)); + let rustc_src_dir = rustc_src_dir.read_link_utf8().unwrap_or(rustc_src_dir.to_path_buf()); + normalize_path(&rustc_src_dir.join("compiler"), "$COMPILER_DIR_REAL"); + // eg. // /home/user/rust/build/x86_64-unknown-linux-gnu/test/ui/<test_dir>/$name.$revision.$mode/ normalize_path(&self.output_base_dir(), "$TEST_BUILD_DIR"); |
