Rollup merge of #129526 - compiler-errors:fx, r=lqd

Use `FxHasher` on new solver unconditionally

r? lqd

This should actually fix the inference problem in ad855fe6db, since `HashSet::default` was not inferring the hasher when `HashSet` was coming from the stdlib due to the way that defaulted types/inference vars work. You could cherry-pick this on top of your PR alternatively.
This commit is contained in:
Matthias Krüger 2024-08-26 01:49:02 +02:00 committed by GitHub
commit a8a242c0ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 6 deletions

View File

@ -4536,6 +4536,7 @@ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"derive-where", "derive-where",
"indexmap", "indexmap",
"rustc-hash",
"rustc_ast_ir", "rustc_ast_ir",
"rustc_data_structures", "rustc_data_structures",
"rustc_index", "rustc_index",

View File

@ -8,6 +8,7 @@ edition = "2021"
bitflags = "2.4.1" bitflags = "2.4.1"
derive-where = "1.2.7" derive-where = "1.2.7"
indexmap = "2.0.0" indexmap = "2.0.0"
rustc-hash = "1.1.0"
rustc_ast_ir = { path = "../rustc_ast_ir", default-features = false } rustc_ast_ir = { path = "../rustc_ast_ir", default-features = false }
rustc_data_structures = { path = "../rustc_data_structures", optional = true } rustc_data_structures = { path = "../rustc_data_structures", optional = true }
rustc_index = { path = "../rustc_index", default-features = false } rustc_index = { path = "../rustc_index", default-features = false }

View File

@ -1,8 +1,13 @@
use std::hash::BuildHasherDefault;
use rustc_hash::FxHasher;
pub use rustc_hash::{FxHashMap as HashMap, FxHashSet as HashSet};
pub type IndexMap<K, V> = indexmap::IndexMap<K, V, BuildHasherDefault<FxHasher>>;
pub type IndexSet<V> = indexmap::IndexSet<V, BuildHasherDefault<FxHasher>>;
#[cfg(feature = "nightly")] #[cfg(feature = "nightly")]
mod impl_ { mod impl_ {
pub use rustc_data_structures::fx::{
FxHashMap as HashMap, FxHashSet as HashSet, FxIndexMap as IndexMap, FxIndexSet as IndexSet,
};
pub use rustc_data_structures::sso::{SsoHashMap, SsoHashSet}; pub use rustc_data_structures::sso::{SsoHashMap, SsoHashSet};
pub use rustc_data_structures::stack::ensure_sufficient_stack; pub use rustc_data_structures::stack::ensure_sufficient_stack;
pub use rustc_data_structures::sync::Lrc; pub use rustc_data_structures::sync::Lrc;
@ -10,11 +15,9 @@ mod impl_ {
#[cfg(not(feature = "nightly"))] #[cfg(not(feature = "nightly"))]
mod impl_ { mod impl_ {
pub use std::collections::{HashMap, HashMap as SsoHashMap, HashSet, HashSet as SsoHashSet}; pub use std::collections::{HashMap as SsoHashMap, HashSet as SsoHashSet};
pub use std::sync::Arc as Lrc; pub use std::sync::Arc as Lrc;
pub use indexmap::{IndexMap, IndexSet};
#[inline] #[inline]
pub fn ensure_sufficient_stack<R>(f: impl FnOnce() -> R) -> R { pub fn ensure_sufficient_stack<R>(f: impl FnOnce() -> R) -> R {
f() f()