Skip to content

Commit d82a7bc

Browse files
committed
local_id is always != 0 at this point
1 parent cbfa7ce commit d82a7bc

File tree

1 file changed

+10
-11
lines changed
  • compiler/rustc_ast_lowering/src

1 file changed

+10
-11
lines changed

compiler/rustc_ast_lowering/src/lib.rs

+10-11
Original file line numberDiff line numberDiff line change
@@ -549,19 +549,18 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
549549
v.insert(local_id);
550550
self.item_local_id_counter.increment_by(1);
551551

552-
if local_id != hir::ItemLocalId::new(0) {
553-
if let Some(def_id) = self.resolver.opt_local_def_id(ast_node_id) {
554-
self.owners.ensure_contains_elem(def_id, || hir::MaybeOwner::Phantom);
555-
if let o @ hir::MaybeOwner::Phantom = &mut self.owners[def_id] {
556-
// Do not override a `MaybeOwner::Owner` that may already here.
557-
*o = hir::MaybeOwner::NonOwner(hir_id);
558-
}
559-
self.local_id_to_def_id.insert(local_id, def_id);
552+
assert_ne!(local_id, hir::ItemLocalId::new(0));
553+
if let Some(def_id) = self.resolver.opt_local_def_id(ast_node_id) {
554+
self.owners.ensure_contains_elem(def_id, || hir::MaybeOwner::Phantom);
555+
if let o @ hir::MaybeOwner::Phantom = &mut self.owners[def_id] {
556+
// Do not override a `MaybeOwner::Owner` that may already here.
557+
*o = hir::MaybeOwner::NonOwner(hir_id);
560558
}
559+
self.local_id_to_def_id.insert(local_id, def_id);
560+
}
561561

562-
if let Some(traits) = self.resolver.take_trait_map(ast_node_id) {
563-
self.trait_map.insert(hir_id.local_id, traits.into_boxed_slice());
564-
}
562+
if let Some(traits) = self.resolver.take_trait_map(ast_node_id) {
563+
self.trait_map.insert(hir_id.local_id, traits.into_boxed_slice());
565564
}
566565

567566
hir_id

0 commit comments

Comments
 (0)