diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2018-01-11 19:46:51 +0100 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2018-01-23 05:10:38 +0100 |
| commit | 9b57e60f030e9a6b8b633e7ddfaaed611a8a9a36 (patch) | |
| tree | e71126cab40f30e1dc953c3282df1f8769dca63b /src | |
| parent | c166ef9d1b5215186ef8863390d87783ba46e432 (diff) | |
| download | rust-9b57e60f030e9a6b8b633e7ddfaaed611a8a9a36.tar.gz rust-9b57e60f030e9a6b8b633e7ddfaaed611a8a9a36.zip | |
Use delay_span_bug for things that should be errors
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_borrowck/borrowck/check_loans.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/librustc_borrowck/borrowck/check_loans.rs b/src/librustc_borrowck/borrowck/check_loans.rs index 7252a179539..862ea0c240a 100644 --- a/src/librustc_borrowck/borrowck/check_loans.rs +++ b/src/librustc_borrowck/borrowck/check_loans.rs @@ -416,7 +416,14 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> { RegionKind::ReEarlyBound(..) | RegionKind::ReLateBound(..) | RegionKind::ReFree(..) | - RegionKind::ReStatic => return, + RegionKind::ReStatic => { + self.bccx + .tcx + .sess.delay_span_bug(borrow_span, + &format!("unexpected region for local data {:?}", + loan_region)); + return + } // These cannot exist in borrowck RegionKind::ReVar(..) | @@ -430,9 +437,10 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> { let body_id = self.bccx.body.value.hir_id.local_id; if self.bccx.region_scope_tree.containing_body(scope) != Some(body_id) { - // We are borrowing a local data longer than it's storage. + // We are borrowing local data longer than its storage. // This should result in other borrowck errors. - // FIXME: Ensure an error is generated + self.bccx.tcx.sess.delay_span_bug(borrow_span, + "borrowing local data longer than its storage"); return; } |
