From 18aedf6b23db6f409f8d3073ab0c8ca923e9b141 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Wed, 13 Dec 2017 00:14:32 -0600 Subject: [PATCH] Sidestep ICE from `MirBorrowckCtxt::find_closure_span`. --- src/librustc_mir/borrow_check/error_reporting.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/librustc_mir/borrow_check/error_reporting.rs b/src/librustc_mir/borrow_check/error_reporting.rs index 8f07c73b5eec..dafd030a966a 100644 --- a/src/librustc_mir/borrow_check/error_reporting.rs +++ b/src/librustc_mir/borrow_check/error_reporting.rs @@ -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 {