diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2017-12-13 00:14:32 -0600 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2017-12-13 15:48:21 -0600 |
| commit | 18aedf6b23db6f409f8d3073ab0c8ca923e9b141 (patch) | |
| tree | d794c965083b25db7769d5e534e32194193d74da | |
| parent | 9cb92ac27d12c7ded8a1ad736b23e2fe1c99577e (diff) | |
| download | rust-18aedf6b23db6f409f8d3073ab0c8ca923e9b141.tar.gz rust-18aedf6b23db6f409f8d3073ab0c8ca923e9b141.zip | |
Sidestep ICE from `MirBorrowckCtxt::find_closure_span`.
| -rw-r--r-- | src/librustc_mir/borrow_check/error_reporting.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/librustc_mir/borrow_check/error_reporting.rs b/src/librustc_mir/borrow_check/error_reporting.rs index 8f07c73b5ee..dafd030a966 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 { |
