Rollup merge of #141675 - nnethercote:ItemKind-field-order, r=fee1-dead

Reorder `ast::ItemKind::{Struct,Enum,Union}` fields.

So they match the order of the parts in the source code, e.g.:
```
struct Foo<T, U> { t: T, u: U }
       <-><----> <------------>
       /   |       \
   ident generics  variant_data
```

r? `@fee1-dead`
This commit is contained in:
Jacob Pratt
2025-05-29 04:49:43 +02:00
committed by GitHub
20 changed files with 54 additions and 56 deletions

View File

@@ -1577,7 +1577,7 @@ impl<'a> Parser<'a> {
};
let enum_definition = EnumDef { variants: variants.into_iter().flatten().collect() };
Ok(ItemKind::Enum(ident, enum_definition, generics))
Ok(ItemKind::Enum(ident, generics, enum_definition))
}
fn parse_enum_variant(&mut self, span: Span) -> PResult<'a, Option<Variant>> {
@@ -1732,7 +1732,7 @@ impl<'a> Parser<'a> {
return Err(self.dcx().create_err(err));
};
Ok(ItemKind::Struct(ident, vdata, generics))
Ok(ItemKind::Struct(ident, generics, vdata))
}
/// Parses `union Foo { ... }`.
@@ -1764,7 +1764,7 @@ impl<'a> Parser<'a> {
return Err(err);
};
Ok(ItemKind::Union(ident, vdata, generics))
Ok(ItemKind::Union(ident, generics, vdata))
}
/// This function parses the fields of record structs: