Skip to content

Commit c451e9b

Browse files
committed
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 1279939 commit c451e9b

File tree

1 file changed

+0
-29
lines changed

1 file changed

+0
-29
lines changed

compiler/rustc_metadata/src/locator.rs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@ use crate::rmeta::{METADATA_HEADER, MetadataBlob, rustc_version};
242242
pub(crate) struct CrateLocator<'a> {
243243
// Immutable per-session configuration.
244244
only_needs_metadata: bool,
245-
sysroot: &'a Path,
246245
metadata_loader: &'a dyn MetadataLoader,
247246
cfg_version: &'static str,
248247

@@ -318,7 +317,6 @@ impl<'a> CrateLocator<'a> {
318317

319318
CrateLocator {
320319
only_needs_metadata,
321-
sysroot: sess.opts.sysroot.path(),
322320
metadata_loader,
323321
cfg_version: sess.cfg_version,
324322
crate_name,
@@ -670,33 +668,6 @@ impl<'a> CrateLocator<'a> {
670668
continue;
671669
}
672670

673-
// Ok so at this point we've determined that `(lib, kind)` above is
674-
// a candidate crate to load, and that `slot` is either none (this
675-
// is the first crate of its kind) or if some the previous path has
676-
// the exact same hash (e.g., it's the exact same crate).
677-
//
678-
// In principle these two candidate crates are exactly the same so
679-
// we can choose either of them to link. As a stupidly gross hack,
680-
// however, we favor crate in the sysroot.
681-
//
682-
// You can find more info in rust-lang/rust#39518 and various linked
683-
// issues, but the general gist is that during testing libstd the
684-
// compilers has two candidates to choose from: one in the sysroot
685-
// and one in the deps folder. These two crates are the exact same
686-
// crate but if the compiler chooses the one in the deps folder
687-
// it'll cause spurious errors on Windows.
688-
//
689-
// As a result, we favor the sysroot crate here. Note that the
690-
// candidates are all canonicalized, so we canonicalize the sysroot
691-
// as well.
692-
if let Some(prev) = &ret {
693-
let sysroot = self.sysroot;
694-
let sysroot = try_canonicalize(sysroot).unwrap_or_else(|_| sysroot.to_path_buf());
695-
if prev.starts_with(&sysroot) {
696-
continue;
697-
}
698-
}
699-
700671
// We error eagerly here. If we're locating a rlib, then in theory the full metadata
701672
// could still be in a (later resolved) dylib. In practice, if the rlib and dylib
702673
// were produced in a way where one has full metadata and the other hasn't, it would

0 commit comments

Comments
 (0)