Skip to content

Commit 345e08b

Browse files
committed
Fix rustc_hash ambiguity in miri
There are two rustc_hash crates in the sysroot when building miri and there is no way to disambiguate between the two. Instead use the re-exports of it in the rustc_data_structures crate.
1 parent 549f61a commit 345e08b

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

compiler/rustc_data_structures/src/fx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::hash::BuildHasherDefault;
22

3-
pub use rustc_hash::{FxHashMap, FxHashSet, FxHasher};
3+
pub use rustc_hash::{FxBuildHasher, FxHashMap, FxHashSet, FxHasher};
44

55
pub type StdEntry<'a, K, V> = std::collections::hash_map::Entry<'a, K, V>;
66

src/tools/miri/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;
@@ -878,6 +878,6 @@ pub struct SpanDedupDiagnostic(Mutex<FxHashSet<Span>>);
878878

879879
impl SpanDedupDiagnostic {
880880
pub const fn new() -> Self {
881-
Self(Mutex::new(FxHashSet::with_hasher(rustc_hash::FxBuildHasher)))
881+
Self(Mutex::new(FxHashSet::with_hasher(FxBuildHasher)))
882882
}
883883
}

src/tools/miri/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};
@@ -647,7 +647,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
647647
RejectOpWith::WarningWithoutBacktrace => {
648648
// Deduplicate these warnings *by shim* (not by span)
649649
static DEDUP: Mutex<FxHashSet<String>> =
650-
Mutex::new(FxHashSet::with_hasher(rustc_hash::FxBuildHasher));
650+
Mutex::new(FxHashSet::with_hasher(FxBuildHasher));
651651
let mut emitted_warnings = DEDUP.lock().unwrap();
652652
if !emitted_warnings.contains(op_name) {
653653
// First time we are seeing this.

src/tools/miri/src/lib.rs

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

0 commit comments

Comments
 (0)