Skip to content

Commit 89362fd

Browse files
committed
Auto merge of #149273 - bjorn3:crate_locator_improvements, r=petrochenkov
Don't leak sysroot crates through dependencies Previously if a dependency of the current crate depended on a sysroot crate, then `extern crate` would in the current crate would pick the first loaded version of said sysroot crate even in case of an ambiguity. This is surprising and brittle. For `-Ldependency=` we already blocked this since rust-lang/rust#110229, but the fix didn't account for sysroot crates. Should fix rust-lang/rust#147966
2 parents 8756301 + b56dab5 commit 89362fd

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

src/diagnostics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use std::num::NonZero;
33
use std::sync::Mutex;
44

55
use rustc_abi::{Align, Size};
6+
use rustc_data_structures::fx::{FxBuildHasher, FxHashSet};
67
use rustc_errors::{Diag, DiagMessage, Level};
7-
use rustc_hash::FxHashSet;
88
use rustc_span::{DUMMY_SP, Span, SpanData, Symbol};
99

1010
use crate::borrow_tracker::stacked_borrows::diagnostics::TagHistory;
@@ -899,6 +899,6 @@ pub struct SpanDedupDiagnostic(Mutex<FxHashSet<Span>>);
899899

900900
impl SpanDedupDiagnostic {
901901
pub const fn new() -> Self {
902-
Self(Mutex::new(FxHashSet::with_hasher(rustc_hash::FxBuildHasher)))
902+
Self(Mutex::new(FxHashSet::with_hasher(FxBuildHasher)))
903903
}
904904
}

src/helpers.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::{cmp, iter};
66
use rand::RngCore;
77
use rustc_abi::{Align, ExternAbi, FieldIdx, FieldsShape, Size, Variants};
88
use rustc_apfloat::Float;
9-
use rustc_hash::FxHashSet;
9+
use rustc_data_structures::fx::{FxBuildHasher, FxHashSet};
1010
use rustc_hir::Safety;
1111
use rustc_hir::def::{DefKind, Namespace};
1212
use rustc_hir::def_id::{CRATE_DEF_INDEX, CrateNum, DefId, LOCAL_CRATE};
@@ -663,7 +663,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
663663
RejectOpWith::WarningWithoutBacktrace => {
664664
// Deduplicate these warnings *by shim* (not by span)
665665
static DEDUP: Mutex<FxHashSet<String>> =
666-
Mutex::new(FxHashSet::with_hasher(rustc_hash::FxBuildHasher));
666+
Mutex::new(FxHashSet::with_hasher(FxBuildHasher));
667667
let mut emitted_warnings = DEDUP.lock().unwrap();
668668
if !emitted_warnings.contains(op_name) {
669669
// First time we are seeing this.

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ extern crate rustc_codegen_ssa;
5858
extern crate rustc_const_eval;
5959
extern crate rustc_data_structures;
6060
extern crate rustc_errors;
61-
extern crate rustc_hash;
6261
extern crate rustc_hir;
6362
extern crate rustc_index;
6463
extern crate rustc_log;

0 commit comments

Comments
 (0)