X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc%2Fty%2Fsubst.rs;h=75ba1dd46ca2a8260f4390d720d06a1c63025f57;hb=413790186c65e782e2c0183e933686f7bf35e158;hp=72dfe581ba73586082b7848f030c4c190158448a;hpb=bf54251f907c0979f14e955e0b4f3760ccba5317;p=rust.git 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 @@ fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'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 } } }