Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use FxHasher on new solver unconditionally #129526

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4543,6 +4543,7 @@ dependencies = [
"bitflags 2.6.0",
"derive-where",
"indexmap",
"rustc-hash",
"rustc_ast_ir",
"rustc_data_structures",
"rustc_index",
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_type_ir/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ edition = "2021"
bitflags = "2.4.1"
derive-where = "1.2.7"
indexmap = "2.0.0"
rustc-hash = "1.1.0"
rustc_ast_ir = { path = "../rustc_ast_ir", default-features = false }
rustc_data_structures = { path = "../rustc_data_structures", optional = true }
rustc_index = { path = "../rustc_index", default-features = false }
Expand Down
15 changes: 9 additions & 6 deletions compiler/rustc_type_ir/src/data_structures.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
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")]
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::stack::ensure_sufficient_stack;
pub use rustc_data_structures::sync::Lrc;
}

#[cfg(not(feature = "nightly"))]
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 indexmap::{IndexMap, IndexSet};

#[inline]
pub fn ensure_sufficient_stack<R>(f: impl FnOnce() -> R) -> R {
f()
Expand Down
Loading