diff options
| author | Jacob Pratt <jacob@jhpratt.dev> | 2025-05-29 04:49:43 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-29 04:49:43 +0200 |
| commit | 0ac0285c3f9bf90ae262c8f8ab2f294d56f5f013 (patch) | |
| tree | 4a2216996c7ec986fb61afe9f523e1ad4a779daf /compiler/rustc_parse/src/parser | |
| parent | e96b11267200e898262228077a11b2d93cf5e14a (diff) | |
| parent | 4c4a40f6dfa7630a8817748a687cfdd1335a7358 (diff) | |
| download | rust-0ac0285c3f9bf90ae262c8f8ab2f294d56f5f013.tar.gz rust-0ac0285c3f9bf90ae262c8f8ab2f294d56f5f013.zip | |
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`
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/item.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index babc55ccc0f..c7b0eb11e5a 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -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: |
