about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2019-05-24 13:56:26 +0200
committerFelix S. Klock II <pnkfelix@pnkfx.org>2019-05-24 14:02:19 +0200
commit698e50f98548cfdf36599bb975609c816567f709 (patch)
treedf7fe6e8e22879a7894f583c45a3dd809af17dd0 /src
parent46805805abe58c287fa16963f897fd09d5d97467 (diff)
downloadrust-698e50f98548cfdf36599bb975609c816567f709.tar.gz
rust-698e50f98548cfdf36599bb975609c816567f709.zip
Delay ICE in fold_region so feature gate has chance to stop compilation cleanly.
Diffstat (limited to 'src')
-rw-r--r--src/librustc/ty/subst.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/librustc/ty/subst.rs b/src/librustc/ty/subst.rs
index 72dfe581ba7..75ba1dd46ca 100644
--- a/src/librustc/ty/subst.rs
+++ b/src/librustc/ty/subst.rs
@@ -479,21 +479,22 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for SubstFolder<'a, 'gcx, 'tcx> {
         // the specialized routine `ty::replace_late_regions()`.
         match *r {
             ty::ReEarlyBound(data) => {
-                let r = self.substs.get(data.index as usize).map(|k| k.unpack());
-                match r {
+                let rk = self.substs.get(data.index as usize).map(|k| k.unpack());
+                match rk {
                     Some(UnpackedKind::Lifetime(lt)) => {
                         self.shift_region_through_binders(lt)
                     }
                     _ => {
                         let span = self.span.unwrap_or(DUMMY_SP);
-                        span_bug!(
-                            span,
+                        let msg = format!(
                             "Region parameter out of range \
                              when substituting in region {} (root type={:?}) \
                              (index={})",
                             data.name,
                             self.root_ty,
                             data.index);
+                        self.tcx.sess.delay_span_bug(span, &msg);
+                        r
                     }
                 }
             }