about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Schneider <github35764891676564198441@oli-obk.de>2018-06-20 10:44:31 +0200
committerOliver Schneider <github35764891676564198441@oli-obk.de>2018-06-27 11:17:25 +0200
commitf8e83a606264c66020d6f08be8b1dfbc2a5ebda9 (patch)
treedd63f1d50bce155654b432b6a34209f0e79adda1
parentb2e2c321053a1bed9dd3ebf02e440072d797f3e3 (diff)
downloadrust-f8e83a606264c66020d6f08be8b1dfbc2a5ebda9.tar.gz
rust-f8e83a606264c66020d6f08be8b1dfbc2a5ebda9.zip
Don't generate a new NodeId for universal impl Trait
-rw-r--r--src/librustc/hir/lowering.rs7
-rw-r--r--src/librustc/hir/map/collector.rs10
2 files changed, 10 insertions, 7 deletions
diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs
index d8d222b9a39..18f652854d8 100644
--- a/src/librustc/hir/lowering.rs
+++ b/src/librustc/hir/lowering.rs
@@ -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,
diff --git a/src/librustc/hir/map/collector.rs b/src/librustc/hir/map/collector.rs
index 14cecba490d..f16bf1d7744 100644
--- a/src/librustc/hir/map/collector.rs
+++ b/src/librustc/hir/map/collector.rs
@@ -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())
             }
         }