diff options
| author | Trevor Gross <t.gross35@gmail.com> | 2025-06-20 13:36:00 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-20 13:36:00 -0400 |
| commit | 1e2ac532e4d82862fa58a08f415a6870df963677 (patch) | |
| tree | d078b92934eb51833a2be55a0b001c2f7fe15690 | |
| parent | d2a00eb65f7a35b56e15ce212b6f57d103a5a9e1 (diff) | |
| parent | 815f0b71c70be3ee9d3ad714250d0a467a2e05ee (diff) | |
| download | rust-1e2ac532e4d82862fa58a08f415a6870df963677.tar.gz rust-1e2ac532e4d82862fa58a08f415a6870df963677.zip | |
Rollup merge of #142495 - jdonszelmann:better-repr-template, r=oli-obk
Better template for `#[repr]` attributes
| -rw-r--r-- | compiler/rustc_attr_parsing/src/attributes/repr.rs | 3 | ||||
| -rw-r--r-- | tests/ui/issues/issue-43988.stderr | 4 | ||||
| -rw-r--r-- | tests/ui/repr/repr.stderr | 6 |
3 files changed, 7 insertions, 6 deletions
diff --git a/compiler/rustc_attr_parsing/src/attributes/repr.rs b/compiler/rustc_attr_parsing/src/attributes/repr.rs index c9f9f34bdb7..a31ca8f9632 100644 --- a/compiler/rustc_attr_parsing/src/attributes/repr.rs +++ b/compiler/rustc_attr_parsing/src/attributes/repr.rs @@ -25,7 +25,8 @@ impl<S: Stage> CombineAttributeParser<S> for ReprParser { const PATH: &[Symbol] = &[sym::repr]; const CONVERT: ConvertFn<Self::Item> = AttributeKind::Repr; // FIXME(jdonszelmann): never used - const TEMPLATE: AttributeTemplate = template!(List: "C"); + const TEMPLATE: AttributeTemplate = + template!(List: "C | Rust | align(...) | packed(...) | <integer type> | transparent"); fn extend<'c>( cx: &'c mut AcceptContext<'_, '_, S>, diff --git a/tests/ui/issues/issue-43988.stderr b/tests/ui/issues/issue-43988.stderr index bd4eb8bbed3..fe61e136a51 100644 --- a/tests/ui/issues/issue-43988.stderr +++ b/tests/ui/issues/issue-43988.stderr @@ -38,7 +38,7 @@ LL | #[repr] | ^^^^^^^ | | | expected this to be a list - | help: must be of the form: `#[repr(C)]` + | help: must be of the form: `#[repr(C | Rust | align(...) | packed(...) | <integer type> | transparent)]` error[E0539]: malformed `inline` attribute input --> $DIR/issue-43988.rs:30:5 @@ -64,7 +64,7 @@ LL | let _z = #[repr] 1; | ^^^^^^^ | | | expected this to be a list - | help: must be of the form: `#[repr(C)]` + | help: must be of the form: `#[repr(C | Rust | align(...) | packed(...) | <integer type> | transparent)]` error[E0518]: attribute should be applied to function or closure --> $DIR/issue-43988.rs:5:5 diff --git a/tests/ui/repr/repr.stderr b/tests/ui/repr/repr.stderr index f3b11398eaa..9e581332278 100644 --- a/tests/ui/repr/repr.stderr +++ b/tests/ui/repr/repr.stderr @@ -5,7 +5,7 @@ LL | #[repr] | ^^^^^^^ | | | expected this to be a list - | help: must be of the form: `#[repr(C)]` + | help: must be of the form: `#[repr(C | Rust | align(...) | packed(...) | <integer type> | transparent)]` error[E0539]: malformed `repr` attribute input --> $DIR/repr.rs:4:1 @@ -14,7 +14,7 @@ LL | #[repr = "B"] | ^^^^^^^^^^^^^ | | | expected this to be a list - | help: must be of the form: `#[repr(C)]` + | help: must be of the form: `#[repr(C | Rust | align(...) | packed(...) | <integer type> | transparent)]` error[E0539]: malformed `repr` attribute input --> $DIR/repr.rs:7:1 @@ -23,7 +23,7 @@ LL | #[repr = "C"] | ^^^^^^^^^^^^^ | | | expected this to be a list - | help: must be of the form: `#[repr(C)]` + | help: must be of the form: `#[repr(C | Rust | align(...) | packed(...) | <integer type> | transparent)]` error: aborting due to 3 previous errors |
