Skip to content

Commit 18aedf6

Browse files
committed
Sidestep ICE from MirBorrowckCtxt::find_closure_span.
1 parent 9cb92ac commit 18aedf6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/librustc_mir/borrow_check/error_reporting.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
143143
use rustc::hir::ExprClosure;
144144
use rustc::mir::AggregateKind;
145145

146+
if location.statement_index == self.mir[location.block].statements.len() {
147+
// Code below hasn't been written in a manner to deal with
148+
// a terminator location.
149+
return None;
150+
}
151+
146152
let local = if let StatementKind::Assign(Place::Local(local), _) =
147153
self.mir[location.block].statements[location.statement_index].kind
148154
{

0 commit comments

Comments
 (0)