Skip to content

Commit c95e1cc

Browse files
committed
Auto merge of rust-lang#50874 - nikomatsakis:nll-reset-unification, r=estebank
use `reset_unifications` instead of creating new unification table This eliminates a hot spot in NLL performance.
2 parents bdace29 + 7ed0fd7 commit c95e1cc

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

src/Cargo.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ dependencies = [
588588

589589
[[package]]
590590
name = "ena"
591-
version = "0.9.2"
591+
version = "0.9.3"
592592
source = "registry+https://github.com/rust-lang/crates.io-index"
593593
dependencies = [
594594
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1750,7 +1750,7 @@ version = "128.0.0"
17501750
source = "registry+https://github.com/rust-lang/crates.io-index"
17511751
dependencies = [
17521752
"cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
1753-
"ena 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
1753+
"ena 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
17541754
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
17551755
"parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
17561756
"parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1957,7 +1957,7 @@ name = "rustc_data_structures"
19571957
version = "0.0.0"
19581958
dependencies = [
19591959
"cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
1960-
"ena 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
1960+
"ena 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
19611961
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
19621962
"parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
19631963
"parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2999,7 +2999,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
29992999
"checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab"
30003000
"checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0"
30013001
"checksum elasticlunr-rs 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4511b63d69dd5d31e8e29aed2c132c413f87acea8035d0584801feaab9dd1f0f"
3002-
"checksum ena 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f8b449f3b18c89d2dbe40548d2ee4fa58ea0a08b761992da6ecb9788e4688834"
3002+
"checksum ena 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "88dc8393b3c7352f94092497f6b52019643e493b6b890eb417cdb7c46117e621"
30033003
"checksum endian-type 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d"
30043004
"checksum enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be4551092f4d519593039259a9ed8daedf0da12e5109c5280338073eaeb81180"
30053005
"checksum env_logger 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)" = "be27f8ea102a7182093a80d98f0b78623b580eda8791cbe8e2345fe6e57567a6"

src/librustc/infer/region_constraints/mod.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
318318
// should think carefully about whether it needs to be cleared
319319
// or updated in some way.
320320
let RegionConstraintCollector {
321-
var_infos,
321+
var_infos: _,
322322
data,
323323
lubs,
324324
glbs,
@@ -338,10 +338,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
338338
// un-unified" state. Note that when we unify `a` and `b`, we
339339
// also insert `a <= b` and a `b <= a` edges, so the
340340
// `RegionConstraintData` contains the relationship here.
341-
*unification_table = ut::UnificationTable::new();
342-
for vid in var_infos.indices() {
343-
unification_table.new_key(unify_key::RegionVidKey { min_vid: vid });
344-
}
341+
unification_table.reset_unifications(|vid| unify_key::RegionVidKey { min_vid: vid });
345342

346343
mem::replace(data, RegionConstraintData::default())
347344
}

src/librustc_data_structures/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ path = "lib.rs"
99
crate-type = ["dylib"]
1010

1111
[dependencies]
12-
ena = "0.9.1"
12+
ena = "0.9.3"
1313
log = "0.4"
1414
rustc_cratesio_shim = { path = "../librustc_cratesio_shim" }
1515
serialize = { path = "../libserialize" }

0 commit comments

Comments
 (0)