Skip to content

Commit 9a43c28

Browse files
authored
Rollup merge of rust-lang#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 rust-lang#44828 (The comment thread on the aforementioned issue discusses why its best to just remove this assertion.)
2 parents 14d8055 + 17f6b68 commit 9a43c28

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/librustc_mir/dataflow/impls/borrows.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,11 @@ impl<'a, 'tcx> BitDenotation for Borrows<'a, 'tcx> {
145145
});
146146
match stmt.kind {
147147
mir::StatementKind::EndRegion(region_scope) => {
148-
let borrow_indexes = self.region_map.get(&ReScope(region_scope)).unwrap_or_else(|| {
149-
panic!("could not find BorrowIndexs for region scope {:?}", region_scope);
150-
});
151-
152-
for idx in borrow_indexes { sets.kill(&idx); }
148+
if let Some(borrow_indexes) = self.region_map.get(&ReScope(region_scope)) {
149+
for idx in borrow_indexes { sets.kill(&idx); }
150+
} else {
151+
// (if there is no entry, then there are no borrows to be tracked)
152+
}
153153
}
154154

155155
mir::StatementKind::Assign(_, ref rhs) => {

0 commit comments

Comments
 (0)