Skip to content

Commit 1861535

Browse files
committed
Remove useless and wrong std crates special casing when un-remap sysroot
1 parent c6a9554 commit 1861535

File tree

2 files changed

+2
-29
lines changed

2 files changed

+2
-29
lines changed

compiler/rustc_metadata/src/rmeta/decoder.rs

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,34 +1649,7 @@ impl<'a> CrateMetadataRef<'a> {
16491649
old_name
16501650
&& let Ok(rest) = virtual_name.strip_prefix(virtual_dir)
16511651
{
1652-
// The std library crates are in
1653-
// `$sysroot/lib/rustlib/src/rust/library`, whereas other crates
1654-
// may be in `$sysroot/lib/rustlib/src/rust/` directly. So we
1655-
// detect crates from the std libs and handle them specially.
1656-
const STD_LIBS: &[&str] = &[
1657-
"core",
1658-
"alloc",
1659-
"std",
1660-
"test",
1661-
"term",
1662-
"unwind",
1663-
"proc_macro",
1664-
"panic_abort",
1665-
"panic_unwind",
1666-
"profiler_builtins",
1667-
"rtstartup",
1668-
"rustc-std-workspace-core",
1669-
"rustc-std-workspace-alloc",
1670-
"rustc-std-workspace-std",
1671-
"backtrace",
1672-
];
1673-
let is_std_lib = STD_LIBS.iter().any(|l| rest.starts_with(l));
1674-
1675-
let new_path = if is_std_lib {
1676-
real_dir.join("library").join(rest)
1677-
} else {
1678-
real_dir.join(rest)
1679-
};
1652+
let new_path = real_dir.join(rest);
16801653

16811654
debug!(
16821655
"try_to_translate_virtual_to_real: `{}` -> `{}`",

tests/codegen/remap_path_prefix/issue-73167-remap-std.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// true automatically. If paths to std library hasn't been remapped, we use the
88
// above simulate-remapped-rust-src-base option to do it temporarily
99

10-
// CHECK: !DIFile(filename: "{{/rustc/.*/library/std/src/panic.rs}}"
10+
// CHECK: !DIFile(filename: "{{/rustc/xyz/library/std/src/panic.rs}}"
1111
fn main() {
1212
std::thread::spawn(|| {
1313
println!("hello");

0 commit comments

Comments
 (0)