Skip to content

Commit f8e83a6

Browse files
committed
Don't generate a new NodeId for universal impl Trait
1 parent b2e2c32 commit f8e83a6

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/librustc/hir/lowering.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,18 +1167,17 @@ impl<'a> LoweringContext<'a> {
11671167
}
11681168
hir::TyTraitObject(bounds, lifetime_bound)
11691169
}
1170-
TyKind::ImplTrait(exist_ty_node_id, ref bounds) => {
1170+
TyKind::ImplTrait(def_node_id, ref bounds) => {
11711171
let span = t.span;
11721172
match itctx {
11731173
ImplTraitContext::Existential(fn_def_id) => {
11741174
self.lower_existential_impl_trait(
1175-
span, fn_def_id, exist_ty_node_id,
1175+
span, fn_def_id, def_node_id,
11761176
|this| this.lower_param_bounds(bounds, itctx),
11771177
)
11781178
}
11791179
ImplTraitContext::Universal(def_id) => {
1180-
let def_node_id = self.next_id().node_id;
1181-
1180+
self.lower_node_id(def_node_id);
11821181
// Add a definition for the in-band TyParam
11831182
let def_index = self.resolver.definitions().create_def_with_parent(
11841183
def_id.index,

src/librustc/hir/map/collector.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,23 +221,27 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
221221
// Make sure that the DepNode of some node coincides with the HirId
222222
// owner of that node.
223223
if cfg!(debug_assertions) {
224-
let hir_id_owner = self.definitions.node_to_hir_id(id).owner;
224+
let hir_id = self.definitions.node_to_hir_id(id);
225225

226-
if hir_id_owner != self.current_dep_node_owner {
226+
if hir_id.owner != self.current_dep_node_owner {
227227
let node_str = match self.definitions.opt_def_index(id) {
228228
Some(def_index) => {
229229
self.definitions.def_path(def_index).to_string_no_crate()
230230
}
231231
None => format!("{:?}", node)
232232
};
233233

234+
if hir_id == ::hir::DUMMY_HIR_ID {
235+
println!("Maybe you forgot to lower the node id {:?}?", id);
236+
}
237+
234238
bug!("inconsistent DepNode for `{}`: \
235239
current_dep_node_owner={}, hir_id.owner={}",
236240
node_str,
237241
self.definitions
238242
.def_path(self.current_dep_node_owner)
239243
.to_string_no_crate(),
240-
self.definitions.def_path(hir_id_owner).to_string_no_crate())
244+
self.definitions.def_path(hir_id.owner).to_string_no_crate())
241245
}
242246
}
243247

0 commit comments

Comments
 (0)