diff --git a/src/librustc_mir/dataflow/impls/borrows.rs b/src/librustc_mir/dataflow/impls/borrows.rs index 22ba7479ead..9321121fe15 100644 --- a/src/librustc_mir/dataflow/impls/borrows.rs +++ b/src/librustc_mir/dataflow/impls/borrows.rs @@ -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) => {