Skip to content

Commit fb832ff

Browse files
committed
Auto merge of #17954 - Noratrieb:rustc-blazing-hash, r=Veykril
Update rustc-hash to version 2 This brings in the new optimized algorithm that was shown to have small performance benefits for rustc. I haven't run the rust-analyzer benchmarks. See rust-lang/rustc-hash#37.
2 parents 9323b53 + 02e189d commit fb832ff

File tree

13 files changed

+227
-218
lines changed

13 files changed

+227
-218
lines changed

Cargo.lock

+30-24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ process-wrap = { version = "8.0.2", features = ["std"] }
136136
pulldown-cmark-to-cmark = "10.0.4"
137137
pulldown-cmark = { version = "0.9.0", default-features = false }
138138
rayon = "1.8.0"
139-
rustc-hash = "1.1.0"
139+
rustc-hash = "2.0.0"
140140
semver = "1.0.14"
141141
serde = { version = "1.0.192", features = ["derive"] }
142142
serde_json = "1.0.108"

crates/hir-ty/src/consteval/tests.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ fn check_answer(ra_fixture: &str, check: impl FnOnce(&[u8], &MemoryMap)) {
9595
fn pretty_print_err(e: ConstEvalError, db: TestDB) -> String {
9696
let mut err = String::new();
9797
let span_formatter = |file, range| format!("{file:?} {range:?}");
98-
let edition = db.crate_graph()[db.test_crate()].edition;
98+
let edition =
99+
db.crate_graph()[*db.crate_graph().crates_in_topological_order().last().unwrap()].edition;
99100
match e {
100101
ConstEvalError::MirLowerError(e) => e.pretty_print(&mut err, &db, span_formatter, edition),
101102
ConstEvalError::MirEvalError(e) => e.pretty_print(&mut err, &db, span_formatter, edition),
@@ -2896,7 +2897,7 @@ fn recursive_adt() {
28962897
{
28972898
const VARIANT_TAG_TREE: TagTree = TagTree::Choice(
28982899
&[
2899-
TagTree::Leaf,
2900+
TAG_TREE,
29002901
],
29012902
);
29022903
VARIANT_TAG_TREE
@@ -2905,6 +2906,6 @@ fn recursive_adt() {
29052906
TAG_TREE
29062907
};
29072908
"#,
2908-
|e| matches!(e, ConstEvalError::MirEvalError(MirEvalError::StackOverflow)),
2909+
|e| matches!(e, ConstEvalError::MirLowerError(MirLowerError::Loop)),
29092910
);
29102911
}

crates/hir-ty/src/lib.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,7 @@ mod test_db;
5151
#[cfg(test)]
5252
mod tests;
5353

54-
use std::{
55-
collections::hash_map::Entry,
56-
hash::{BuildHasherDefault, Hash},
57-
};
54+
use std::hash::Hash;
5855

5956
use base_db::ra_salsa::InternValueTrivial;
6057
use chalk_ir::{
@@ -65,10 +62,11 @@ use chalk_ir::{
6562
use either::Either;
6663
use hir_def::{hir::ExprId, type_ref::Rawness, CallableDefId, GeneralConstId, TypeOrConstParamId};
6764
use hir_expand::name::Name;
65+
use indexmap::{map::Entry, IndexMap};
6866
use intern::{sym, Symbol};
6967
use la_arena::{Arena, Idx};
7068
use mir::{MirEvalError, VTableMap};
71-
use rustc_hash::{FxHashMap, FxHashSet};
69+
use rustc_hash::{FxBuildHasher, FxHashMap, FxHashSet};
7270
use span::Edition;
7371
use syntax::ast::{make, ConstArg};
7472
use traits::FnTrait;
@@ -199,7 +197,7 @@ pub enum MemoryMap {
199197

200198
#[derive(Debug, Default, Clone, PartialEq, Eq)]
201199
pub struct ComplexMemoryMap {
202-
memory: FxHashMap<usize, Box<[u8]>>,
200+
memory: IndexMap<usize, Box<[u8]>, FxBuildHasher>,
203201
vtable: VTableMap,
204202
}
205203

@@ -245,7 +243,7 @@ impl MemoryMap {
245243
match self {
246244
MemoryMap::Empty => Ok(Default::default()),
247245
MemoryMap::Simple(m) => transform((&0, m)).map(|(addr, val)| {
248-
let mut map = FxHashMap::with_capacity_and_hasher(1, BuildHasherDefault::default());
246+
let mut map = FxHashMap::with_capacity_and_hasher(1, rustc_hash::FxBuildHasher);
249247
map.insert(addr, val);
250248
map
251249
}),

crates/ide-assists/src/handlers/bool_to_enum.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,7 @@ fn main() {
10951095

10961096
#[test]
10971097
fn field_enum_cross_file() {
1098+
// FIXME: The import is missing
10981099
check_assist(
10991100
bool_to_enum,
11001101
r#"
@@ -1132,7 +1133,7 @@ fn foo() {
11321133
}
11331134
11341135
//- /main.rs
1135-
use foo::{Bool, Foo};
1136+
use foo::Foo;
11361137
11371138
mod foo;
11381139

crates/ide-completion/src/render.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1853,8 +1853,8 @@ fn f() { A { bar: b$0 }; }
18531853
expect![[r#"
18541854
fn bar() [type+name]
18551855
fn baz() [type]
1856-
ex baz() [type]
18571856
ex bar() [type]
1857+
ex baz() [type]
18581858
st A []
18591859
fn f() []
18601860
"#]],

0 commit comments

Comments
 (0)