1
Fork 0

Auto merge of #115131 - frank-king:feature/unnamed-fields-lite, r=petrochenkov

Parse unnamed fields and anonymous structs or unions (no-recovery)

It is part of #114782 which implements #49804. Only parse anonymous structs or unions in struct field definition positions.

r? `@petrochenkov`
This commit is contained in:
bors 2023-08-24 12:52:35 +00:00
commit 18be2728bd
25 changed files with 650 additions and 5 deletions

View file

@ -1064,6 +1064,14 @@ impl<'a> State<'a> {
}
self.pclose();
}
ast::TyKind::AnonStruct(fields) => {
self.head("struct");
self.print_record_struct_body(&fields, ty.span);
}
ast::TyKind::AnonUnion(fields) => {
self.head("union");
self.print_record_struct_body(&fields, ty.span);
}
ast::TyKind::Paren(typ) => {
self.popen();
self.print_type(typ);

View file

@ -443,7 +443,11 @@ impl<'a> State<'a> {
}
}
fn print_record_struct_body(&mut self, fields: &[ast::FieldDef], span: rustc_span::Span) {
pub(crate) fn print_record_struct_body(
&mut self,
fields: &[ast::FieldDef],
span: rustc_span::Span,
) {
self.nbsp();
self.bopen();