Skip to content

Commit 446708b

Browse files
committedMar 8, 2024·
Remove a workaround for a bug
I don't think it is necessary anymore. As I understand it from issue 39504 the original problem was that rustbuild changed a hardlink in the cargo build dir to point to copy in the sysroot while cargo may have hardlinked it to the original first. I don't think this happens anymore and as such this workaround is no longer necessary.
1 parent 14fbc3c commit 446708b

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed
 

‎compiler/rustc_metadata/src/locator.rs

-28
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ use std::{cmp, fmt};
243243
pub(crate) struct CrateLocator<'a> {
244244
// Immutable per-session configuration.
245245
only_needs_metadata: bool,
246-
sysroot: &'a Path,
247246
metadata_loader: &'a dyn MetadataLoader,
248247
cfg_version: &'static str,
249248

@@ -319,7 +318,6 @@ impl<'a> CrateLocator<'a> {
319318

320319
CrateLocator {
321320
only_needs_metadata,
322-
sysroot: &sess.sysroot,
323321
metadata_loader,
324322
cfg_version: sess.cfg_version,
325323
crate_name,
@@ -610,32 +608,6 @@ impl<'a> CrateLocator<'a> {
610608
continue;
611609
}
612610

613-
// Ok so at this point we've determined that `(lib, kind)` above is
614-
// a candidate crate to load, and that `slot` is either none (this
615-
// is the first crate of its kind) or if some the previous path has
616-
// the exact same hash (e.g., it's the exact same crate).
617-
//
618-
// In principle these two candidate crates are exactly the same so
619-
// we can choose either of them to link. As a stupidly gross hack,
620-
// however, we favor crate in the sysroot.
621-
//
622-
// You can find more info in rust-lang/rust#39518 and various linked
623-
// issues, but the general gist is that during testing libstd the
624-
// compilers has two candidates to choose from: one in the sysroot
625-
// and one in the deps folder. These two crates are the exact same
626-
// crate but if the compiler chooses the one in the deps folder
627-
// it'll cause spurious errors on Windows.
628-
//
629-
// As a result, we favor the sysroot crate here. Note that the
630-
// candidates are all canonicalized, so we canonicalize the sysroot
631-
// as well.
632-
if let Some((prev, _)) = &ret {
633-
let sysroot = self.sysroot;
634-
let sysroot = try_canonicalize(sysroot).unwrap_or_else(|_| sysroot.to_path_buf());
635-
if prev.starts_with(&sysroot) {
636-
continue;
637-
}
638-
}
639611
*slot = Some((hash, metadata, lib.clone()));
640612
ret = Some((lib, kind));
641613
}

0 commit comments

Comments
 (0)
Please sign in to comment.