Skip to content

Commit d00d4e9

Browse files
committed
Store a new Region value every time we create a new region variable
1 parent 930d3b1 commit d00d4e9

File tree

1 file changed

+11
-2
lines changed
  • src/librustc_mir/transform

1 file changed

+11
-2
lines changed

src/librustc_mir/transform/nll.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ use rustc::mir::{Mir, Location, Rvalue, BasicBlock, Statement, StatementKind};
1515
use rustc::mir::visit::{MutVisitor, Lookup};
1616
use rustc::mir::transform::{MirPass, MirSource};
1717
use rustc::infer::{self, InferCtxt};
18+
use rustc::util::nodemap::FxHashSet;
1819
use syntax_pos::DUMMY_SP;
1920
use std::collections::HashMap;
2021

2122
#[allow(dead_code)]
2223
struct NLLVisitor<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
2324
lookup_map: HashMap<RegionVid, Lookup>,
25+
regions: Vec<Region>,
2426
infcx: InferCtxt<'a, 'gcx, 'tcx>,
2527
}
2628

@@ -29,15 +31,17 @@ impl<'a, 'gcx, 'tcx> NLLVisitor<'a, 'gcx, 'tcx> {
2931
NLLVisitor {
3032
infcx,
3133
lookup_map: HashMap::new(),
34+
regions: vec![],
3235
}
3336
}
3437

3538
pub fn into_results(self) -> HashMap<RegionVid, Lookup> {
3639
self.lookup_map
3740
}
3841

39-
fn renumber_regions<T>(&self, value: &T) -> T where T: TypeFoldable<'tcx> {
42+
fn renumber_regions<T>(&mut self, value: &T) -> T where T: TypeFoldable<'tcx> {
4043
self.infcx.tcx.fold_regions(value, &mut false, |_region, _depth| {
44+
self.regions.push(Region::default());
4145
self.infcx.next_region_var(infer::MiscVariable(DUMMY_SP))
4246
})
4347
}
@@ -143,4 +147,9 @@ impl MirPass for NLL {
143147
let _results = visitor.into_results();
144148
})
145149
}
146-
}
150+
}
151+
152+
#[derive(Clone, Debug, Default, PartialEq, Eq)]
153+
struct Region {
154+
points: FxHashSet<Location>,
155+
}

0 commit comments

Comments
 (0)