From 39434f450bc064cecd58f26199c79044f2f6b340 Mon Sep 17 00:00:00 2001 From: Ruslan Akbashev Date: Wed, 5 Nov 2025 02:46:38 +0400 Subject: [PATCH] fix order, and delimiting and trailing comma for `repr` attribute The `repr()` attribute allows definitions to be specified in any order: #[repr(C, align(64))] struct Foo(i32); #[repr(align(64), C)] struct Bar(i32); They can also only have `Alignment` present: #[repr(align(64))] struct Baz(i32); And a trailing comma: #[repr(packed,)] struct Qux(i32); In addition, previous version of the `Representation` category did not require a delimiting comma (`repr(C packed)`). To fix these issues, introduce a list of representations. --- src/attributes.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/attributes.rst b/src/attributes.rst index 7d3fcb24..67108f3b 100644 --- a/src/attributes.rst +++ b/src/attributes.rst @@ -1499,10 +1499,14 @@ Attribute ``repr`` .. syntax:: ReprContent ::= - $$repr$$ $$($$ Representation $$)$$ + $$repr$$ $$($$ RepresentationList $$)$$ + + RepresentationList ::= + Representation ($$,$$ Representation)* $$,$$? Representation ::= - RepresentationKind Alignment? + RepresentationKind + | Alignment RepresentationKind ::= PrimitiveRepresentation