提交 9a43c28e 编写于 作者: K kennytm 提交者: GitHub

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.)
......@@ -145,11 +145,11 @@ fn statement_effect(&self,
});
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) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册