Sidestep ICE from MirBorrowckCtxt::find_closure_span.

This commit is contained in:
Felix S. Klock II 2017-12-13 00:14:32 -06:00
parent 9cb92ac27d
commit 18aedf6b23

View file

@ -143,6 +143,12 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
use rustc::hir::ExprClosure;
use rustc::mir::AggregateKind;
if location.statement_index == self.mir[location.block].statements.len() {
// Code below hasn't been written in a manner to deal with
// a terminator location.
return None;
}
let local = if let StatementKind::Assign(Place::Local(local), _) =
self.mir[location.block].statements[location.statement_index].kind
{