Rollup merge of #44987 - pnkfelix:mir-borrowck-fix-borrowindexes-ice, r=arielb1

`EndRegion` do not always correspond to borrow-data entries

Remove assertion that the argument to every `EndRegion` correspond to some dataflow-tracked borrow-data entry.

Fix #44828

(The comment thread on the aforementioned issue discusses why its best to just remove this assertion.)
This commit is contained in:
kennytm 2017-10-05 20:22:34 +08:00 committed by GitHub
commit 9a43c28e6b

View File

@ -145,11 +145,11 @@ impl<'a, 'tcx> BitDenotation for Borrows<'a, 'tcx> {
});
match stmt.kind {
mir::StatementKind::EndRegion(region_scope) => {
let borrow_indexes = self.region_map.get(&ReScope(region_scope)).unwrap_or_else(|| {
panic!("could not find BorrowIndexs for region scope {:?}", region_scope);
});
for idx in borrow_indexes { sets.kill(&idx); }
if let Some(borrow_indexes) = self.region_map.get(&ReScope(region_scope)) {
for idx in borrow_indexes { sets.kill(&idx); }
} else {
// (if there is no entry, then there are no borrows to be tracked)
}
}
mir::StatementKind::Assign(_, ref rhs) => {