Skip to content

Commit e980d52

Browse files
authored
Unrolled build for #142318
Rollup merge of #142318 - Urgau:cleanup-rust-src-remap, r=jieyouxu Cleanup `rust-src` remapping and real dir When remapping, `bootstrap` sets `CFG_VIRTUAL_RUST_SOURCE_BASE_DIR` to indicate what the base build dir (`/` of this repo) was remapped to, ie. `/rustc/...`. It is therefore impossible when stripping `/rustc/...` from a remapped path to be inside the our `library/` directory, nevertheless we have code that assumed it was possible and helpfully tried to correct it. I don't why this was done, but it's not necessary. ~~The normalization in compiletest of `$SRC_DIR_REAL` was also slightly wrong, it ate the `library` part for no reason.~~ EDIT: there is a reason, it affects too much tests otherwise r? `@jieyouxu`
2 parents 1434630 + 208f2e4 commit e980d52

File tree

1 file changed

+1
-28
lines changed

1 file changed

+1
-28
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: `{}` -> `{}`",

0 commit comments

Comments
 (0)