Skip to content

Commit 698e50f

Browse files
committed
Delay ICE in fold_region so feature gate has chance to stop compilation cleanly.
1 parent 4680580 commit 698e50f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/librustc/ty/subst.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -479,21 +479,22 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for SubstFolder<'a, 'gcx, 'tcx> {
479479
// the specialized routine `ty::replace_late_regions()`.
480480
match *r {
481481
ty::ReEarlyBound(data) => {
482-
let r = self.substs.get(data.index as usize).map(|k| k.unpack());
483-
match r {
482+
let rk = self.substs.get(data.index as usize).map(|k| k.unpack());
483+
match rk {
484484
Some(UnpackedKind::Lifetime(lt)) => {
485485
self.shift_region_through_binders(lt)
486486
}
487487
_ => {
488488
let span = self.span.unwrap_or(DUMMY_SP);
489-
span_bug!(
490-
span,
489+
let msg = format!(
491490
"Region parameter out of range \
492491
when substituting in region {} (root type={:?}) \
493492
(index={})",
494493
data.name,
495494
self.root_ty,
496495
data.index);
496+
self.tcx.sess.delay_span_bug(span, &msg);
497+
r
497498
}
498499
}
499500
}

0 commit comments

Comments
 (0)