Skip to content

Commit 17f6b68

Browse files
committed
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.)
1 parent 2146c61 commit 17f6b68

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
@@ -122,11 +122,11 @@ impl<'a, 'tcx> BitDenotation for Borrows<'a, 'tcx> {
122122
});
123123
match stmt.kind {
124124
mir::StatementKind::EndRegion(region_scope) => {
125-
let borrow_indexes = self.region_map.get(&ReScope(region_scope)).unwrap_or_else(|| {
126-
panic!("could not find BorrowIndexs for region scope {:?}", region_scope);
127-
});
128-
129-
for idx in borrow_indexes { sets.kill(&idx); }
125+
if let Some(borrow_indexes) = self.region_map.get(&ReScope(region_scope)) {
126+
for idx in borrow_indexes { sets.kill(&idx); }
127+
} else {
128+
// (if there is no entry, then there are no borrows to be tracked)
129+
}
130130
}
131131

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

0 commit comments

Comments
 (0)