1
Fork 0

Auto merge of #50874 - nikomatsakis:nll-reset-unification, r=estebank

use `reset_unifications` instead of creating new unification table

This eliminates a hot spot in NLL performance.
This commit is contained in:
bors 2018-05-19 10:04:42 +00:00
commit c95e1cccc9
3 changed files with 7 additions and 10 deletions

View file

@ -318,7 +318,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
// should think carefully about whether it needs to be cleared
// or updated in some way.
let RegionConstraintCollector {
var_infos,
var_infos: _,
data,
lubs,
glbs,
@ -338,10 +338,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
// un-unified" state. Note that when we unify `a` and `b`, we
// also insert `a <= b` and a `b <= a` edges, so the
// `RegionConstraintData` contains the relationship here.
*unification_table = ut::UnificationTable::new();
for vid in var_infos.indices() {
unification_table.new_key(unify_key::RegionVidKey { min_vid: vid });
}
unification_table.reset_unifications(|vid| unify_key::RegionVidKey { min_vid: vid });
mem::replace(data, RegionConstraintData::default())
}