Use delay_span_bug for things that should be errors
This commit is contained in:
parent
c166ef9d1b
commit
9b57e60f03
1 changed files with 11 additions and 3 deletions
|
@ -416,7 +416,14 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
|
||||||
RegionKind::ReEarlyBound(..) |
|
RegionKind::ReEarlyBound(..) |
|
||||||
RegionKind::ReLateBound(..) |
|
RegionKind::ReLateBound(..) |
|
||||||
RegionKind::ReFree(..) |
|
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
|
// These cannot exist in borrowck
|
||||||
RegionKind::ReVar(..) |
|
RegionKind::ReVar(..) |
|
||||||
|
@ -430,9 +437,10 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
|
||||||
let body_id = self.bccx.body.value.hir_id.local_id;
|
let body_id = self.bccx.body.value.hir_id.local_id;
|
||||||
|
|
||||||
if self.bccx.region_scope_tree.containing_body(scope) != Some(body_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.
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue