Skip to content

Commit 3822c58

Browse files
Auto merge of #150110 - Urgau:remap-relative-library, r=<try>
Prefer remapping the relative `library/` and `compiler/` directories try-job: dist-x86_64-linux
2 parents fcf67da + 0acc846 commit 3822c58

23 files changed

+35
-28
lines changed

compiler/rustc_metadata/src/rmeta/decoder.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,15 +1675,14 @@ impl<'a> CrateMetadataRef<'a> {
16751675
for virtual_dir in virtual_source_base_dir.iter().flatten() {
16761676
if let Some(real_dir) = &real_source_base_dir
16771677
&& let rustc_span::FileName::Real(old_name) = name
1678-
&& let (_working_dir, embeddable_name) =
1679-
old_name.embeddable_name(RemapPathScopeComponents::MACRO)
1680-
&& let Ok(rest) = embeddable_name.strip_prefix(virtual_dir)
1678+
&& let virtual_path = old_name.path(RemapPathScopeComponents::MACRO)
1679+
&& let Ok(rest) = virtual_path.strip_prefix(virtual_dir)
16811680
{
16821681
let new_path = real_dir.join(rest);
16831682

16841683
debug!(
16851684
"try_to_translate_virtual_to_real: `{}` -> `{}`",
1686-
embeddable_name.display(),
1685+
virtual_path.display(),
16871686
new_path.display(),
16881687
);
16891688

src/bootstrap/src/core/builder/cargo.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,10 +1032,7 @@ impl Builder<'_> {
10321032
self.build.debuginfo_map_to(GitRepo::Rustc, RemapScheme::Compiler)
10331033
{
10341034
// When building compiler sources, we want to apply the compiler remap scheme.
1035-
cargo.env(
1036-
"RUSTC_DEBUGINFO_MAP",
1037-
format!("{}={}", self.build.src.display(), map_to),
1038-
);
1035+
cargo.env("RUSTC_DEBUGINFO_MAP", format!("compiler/={map_to}/compiler"));
10391036
cargo.env("CFG_VIRTUAL_RUSTC_DEV_SOURCE_BASE_DIR", map_to);
10401037
}
10411038
}
@@ -1047,10 +1044,7 @@ impl Builder<'_> {
10471044
if let Some(ref map_to) =
10481045
self.build.debuginfo_map_to(GitRepo::Rustc, RemapScheme::NonCompiler)
10491046
{
1050-
cargo.env(
1051-
"RUSTC_DEBUGINFO_MAP",
1052-
format!("{}={}", self.build.src.display(), map_to),
1053-
);
1047+
cargo.env("RUSTC_DEBUGINFO_MAP", format!("library/={map_to}/library"));
10541048
}
10551049
}
10561050
}

tests/ui/extern/extern-types-field-offset.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//@ check-run-results
33
//@ exec-env:RUST_BACKTRACE=0
44
//@ normalize-stderr: "(core/src/panicking\.rs):[0-9]+:[0-9]+" -> "$1:$$LINE:$$COL"
5+
//@ normalize-stderr: "/rustc(?:-dev)?/[a-z0-9.]+/" -> ""
56
//@ ignore-backends: gcc
67
#![feature(extern_types)]
78

tests/ui/hygiene/panic-location.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//@ check-run-results
33
//@ exec-env:RUST_BACKTRACE=0
44
//@ normalize-stderr: ".rs:\d+:\d+" -> ".rs:LL:CC"
5+
//@ normalize-stderr: "/rustc(?:-dev)?/[a-z0-9.]+/" -> ""
56
//
67
// Regression test for issue #70963
78
// The reported panic location should not be `<::core::macros::panic macros>`.

tests/ui/mir/lint/storage-live.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
//@ normalize-stderr: "thread 'rustc'.*panicked.*\n" -> ""
55
//@ normalize-stderr: "storage_live\[....\]" -> "storage_live[HASH]"
66
//@ normalize-stderr: "(delayed at [^:]+):\d+:\d+ - " -> "$1:LL:CC - "
7+
//@ normalize-stderr: "/rustc(?:-dev)?/[a-z0-9.]+/" -> ""
78
//@ rustc-env:RUST_BACKTRACE=0
89

910
#![feature(custom_mir, core_intrinsics)]

tests/ui/mir/lint/storage-live.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
error: internal compiler error: broken MIR in Item(DefId(0:8 ~ storage_live[HASH]::multiple_storage)) (after pass CheckForceInline) at bb0[1]:
22
StorageLive(_1) which already has storage here
3-
--> $DIR/storage-live.rs:21:13
3+
--> $DIR/storage-live.rs:22:13
44
|
55
LL | StorageLive(a);
66
| ^^^^^^^^^^^^^^
77
|
88
note: delayed at compiler/rustc_mir_transform/src/lint.rs:LL:CC - disabled backtrace
9-
--> $DIR/storage-live.rs:21:13
9+
--> $DIR/storage-live.rs:22:13
1010
|
1111
LL | StorageLive(a);
1212
| ^^^^^^^^^^^^^^

tests/ui/panics/panic-in-cleanup.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
//@ normalize-stderr: "\n +[0-9]+:[^\n]+" -> ""
66
//@ normalize-stderr: "\n +at [^\n]+" -> ""
77
//@ normalize-stderr: "(core/src/panicking\.rs):[0-9]+:[0-9]+" -> "$1:$$LINE:$$COL"
8+
//@ normalize-stderr: "/rustc(?:-dev)?/[a-z0-9.]+/" -> ""
89
//@ needs-unwind
910
//@ ignore-emscripten "RuntimeError" junk in output
1011
//@ ignore-msvc SEH doesn't do panic-during-cleanup the same way as everyone else

tests/ui/panics/panic-in-cleanup.run.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

2-
thread 'main' ($TID) panicked at $DIR/panic-in-cleanup.rs:22:5:
2+
thread 'main' ($TID) panicked at $DIR/panic-in-cleanup.rs:23:5:
33
explicit panic
44
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
55

6-
thread 'main' ($TID) panicked at $DIR/panic-in-cleanup.rs:16:9:
6+
thread 'main' ($TID) panicked at $DIR/panic-in-cleanup.rs:17:9:
77
BOOM
88
stack backtrace:
99

tests/ui/panics/panic-in-ffi.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//@ normalize-stderr: "\n +[0-9]+:[^\n]+" -> ""
77
//@ normalize-stderr: "\n +at [^\n]+" -> ""
88
//@ normalize-stderr: "(core/src/panicking\.rs):[0-9]+:[0-9]+" -> "$1:$$LINE:$$COL"
9+
//@ normalize-stderr: "/rustc(?:-dev)?/[a-z0-9.]+/" -> ""
910
//@ needs-unwind
1011
//@ ignore-emscripten "RuntimeError" junk in output
1112

tests/ui/panics/panic-in-ffi.run.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
thread 'main' ($TID) panicked at $DIR/panic-in-ffi.rs:21:5:
2+
thread 'main' ($TID) panicked at $DIR/panic-in-ffi.rs:22:5:
33
Test
44
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
55
Noisy Drop

0 commit comments

Comments
 (0)