-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HirIdify hir::ItemId #59092
HirIdify hir::ItemId #59092
Conversation
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Yep, that's the one; I thought I could adjust it to compare vs. 1 on the right hand side, but then it fails with |
@@ -519,7 +518,8 @@ impl<'a> LoweringContext<'a> { | |||
} | |||
} | |||
|
|||
fn insert_item(&mut self, id: NodeId, item: hir::Item) { | |||
fn insert_item(&mut self, item: hir::Item) { | |||
let id = item.hir_id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could try asserting that the local id of the item is 0 here?
You could also try printing out information about the item which isn't 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got one:
non-zero local id in Item {
ident: TryFrom#0,
hir_id: HirId { owner: DefIndex(0:147), local_id: 1 },
attrs: [],
node: Use(path(convert::TryFrom), Single),
vis: Spanned { node: Inherited, span: Span { lo: BytePos(73297), hi: BytePos(73297), ctxt: #0 } },
span: Span { lo: BytePos(73311), hi: BytePos(73318), ctxt: #0 }
}
This is likely an error in |
Are you sure all the items should have a |
|
||
node_ids.into_iter() | ||
.map(|node_id| hir::ItemId { id: self.lower_node_id(node_id).hir_id }) | ||
.collect() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I replaced this with:
node_ids.into_iter().map(|node_id| hir::ItemId {
id: self.lower_node_id_generic(node_id, |_| {
panic!("expected node_id to be lowered already {:#?}", i)
}).hir_id
}).collect()
That panics and shows the the following item wasn't assigned a HirId
:
expected node_id to be lowered already Item {
ident: #0,
attrs: [],
id: NodeId(2249),
node: Use(
UseTree {
prefix: path(convert),
kind: Nested(
[
(
UseTree {
prefix: path(TryFrom),
kind: Simple(
None,
NodeId(2252),
NodeId(2253)
),
},
NodeId(2254)
),
(
UseTree {
prefix: path(Infallible),
kind: Simple(
None,
NodeId(2256),
NodeId(2257)
),
},
NodeId(2258)
)
]
),
}
),
vis: Spanned {
node: Inherited,
},
}
I guess this means that either too many NodeId
s are in this list or some id is not being correctly lowered to a HirId
.
@oli-obk Do you have any ideas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These node ids haven't been lowered yet at all. lower_item_id
is called before the item is lowered in order to obtain any sub-item's ids. If you want to error if a second lowering fails, you'll need to do that where the actual items are lowered (so after lower_item_id
is called).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that only AST items had their ids lowered in MiscCollector
. I changed that to also include the use trees in #59413.
HirIdify hir::ItemId Version of rust-lang#59092. r? @oli-obk
☔ The latest upstream changes (presumably #59478) made this pull request unmergeable. Please resolve the merge conflicts. |
@Zoxc is this done now? should this be closed? |
Yep, this was a part of the merged PR. |
Pushing the limits of HirIdification (#57578).
Replaces
NodeId
withHirId
inhir::ItemId
. It currently fails during adebug_assert
in https://github.com/rust-lang/rust/blob/master/src/librustc/ich/impls_hir.rs#L793.r? @Zoxc