Lower anonymous structs or unions to HIR

This commit is contained in:
Frank King 2024-01-04 21:53:06 +08:00
parent 084ce5bdb5
commit 879a1e5713
38 changed files with 288 additions and 174 deletions

View file

@ -756,6 +756,13 @@ impl<'hir> Map<'hir> {
}
}
pub fn expect_field(self, id: HirId) -> &'hir FieldDef<'hir> {
match self.tcx.hir_node(id) {
Node::Field(field) => field,
_ => bug!("expected field, found {}", self.node_to_string(id)),
}
}
pub fn expect_foreign_item(self, id: OwnerId) -> &'hir ForeignItem<'hir> {
match self.tcx.hir_owner_node(id) {
OwnerNode::ForeignItem(item) => item,