1
Fork 0

Don't generate a new NodeId for universal impl Trait

This commit is contained in:
Oliver Schneider 2018-06-20 10:44:31 +02:00
parent b2e2c32105
commit f8e83a6062
2 changed files with 10 additions and 7 deletions

View file

@ -1167,18 +1167,17 @@ impl<'a> LoweringContext<'a> {
}
hir::TyTraitObject(bounds, lifetime_bound)
}
TyKind::ImplTrait(exist_ty_node_id, ref bounds) => {
TyKind::ImplTrait(def_node_id, ref bounds) => {
let span = t.span;
match itctx {
ImplTraitContext::Existential(fn_def_id) => {
self.lower_existential_impl_trait(
span, fn_def_id, exist_ty_node_id,
span, fn_def_id, def_node_id,
|this| this.lower_param_bounds(bounds, itctx),
)
}
ImplTraitContext::Universal(def_id) => {
let def_node_id = self.next_id().node_id;
self.lower_node_id(def_node_id);
// Add a definition for the in-band TyParam
let def_index = self.resolver.definitions().create_def_with_parent(
def_id.index,

View file

@ -221,9 +221,9 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
// Make sure that the DepNode of some node coincides with the HirId
// owner of that node.
if cfg!(debug_assertions) {
let hir_id_owner = self.definitions.node_to_hir_id(id).owner;
let hir_id = self.definitions.node_to_hir_id(id);
if hir_id_owner != self.current_dep_node_owner {
if hir_id.owner != self.current_dep_node_owner {
let node_str = match self.definitions.opt_def_index(id) {
Some(def_index) => {
self.definitions.def_path(def_index).to_string_no_crate()
@ -231,13 +231,17 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
None => format!("{:?}", node)
};
if hir_id == ::hir::DUMMY_HIR_ID {
println!("Maybe you forgot to lower the node id {:?}?", id);
}
bug!("inconsistent DepNode for `{}`: \
current_dep_node_owner={}, hir_id.owner={}",
node_str,
self.definitions
.def_path(self.current_dep_node_owner)
.to_string_no_crate(),
self.definitions.def_path(hir_id_owner).to_string_no_crate())
self.definitions.def_path(hir_id.owner).to_string_no_crate())
}
}