Skip to content
Permalink
Browse files

Delay ICE in early_free_scope so feature gate has chance to stop comp…

…ilation cleanly.
  • Loading branch information...
pnkfelix committed May 24, 2019
1 parent 698e50f commit 8e4132a55c625de8ba431a4e9fe72339c777e96a
Showing with 9 additions and 6 deletions.
  1. +9 −6 src/librustc/middle/region.rs
@@ -658,12 +658,15 @@ impl<'tcx> ScopeTree {
// The lifetime was defined on node that doesn't own a body,
// which in practice can only mean a trait or an impl, that
// is the parent of a method, and that is enforced below.
assert_eq!(Some(param_owner_id), self.root_parent,
"free_scope: {:?} not recognized by the \
region scope tree for {:?} / {:?}",
param_owner,
self.root_parent.map(|id| tcx.hir().local_def_id_from_hir_id(id)),
self.root_body.map(|hir_id| DefId::local(hir_id.owner)));
if Some(param_owner_id) != self.root_parent {
tcx.sess.delay_span_bug(
DUMMY_SP,
&format!("free_scope: {:?} not recognized by the \
region scope tree for {:?} / {:?}",
param_owner,
self.root_parent.map(|id| tcx.hir().local_def_id_from_hir_id(id)),
self.root_body.map(|hir_id| DefId::local(hir_id.owner))));
}

// The trait/impl lifetime is in scope for the method's body.
self.root_body.unwrap().local_id

0 comments on commit 8e4132a

Please sign in to comment.
You can’t perform that action at this time.