Skip to content

Commit 815f0b7

Browse files
committed
better template for repr attributes
1 parent 1bb3352 commit 815f0b7

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

compiler/rustc_attr_parsing/src/attributes/repr.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ impl<S: Stage> CombineAttributeParser<S> for ReprParser {
2525
const PATH: &[Symbol] = &[sym::repr];
2626
const CONVERT: ConvertFn<Self::Item> = AttributeKind::Repr;
2727
// FIXME(jdonszelmann): never used
28-
const TEMPLATE: AttributeTemplate = template!(List: "C");
28+
const TEMPLATE: AttributeTemplate =
29+
template!(List: "C | Rust | align(...) | packed(...) | <integer type> | transparent");
2930

3031
fn extend<'c>(
3132
cx: &'c mut AcceptContext<'_, '_, S>,

tests/ui/issues/issue-43988.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ LL | #[repr]
3838
| ^^^^^^^
3939
| |
4040
| expected this to be a list
41-
| help: must be of the form: `#[repr(C)]`
41+
| help: must be of the form: `#[repr(C | Rust | align(...) | packed(...) | <integer type> | transparent)]`
4242

4343
error[E0539]: malformed `inline` attribute input
4444
--> $DIR/issue-43988.rs:30:5
@@ -64,7 +64,7 @@ LL | let _z = #[repr] 1;
6464
| ^^^^^^^
6565
| |
6666
| expected this to be a list
67-
| help: must be of the form: `#[repr(C)]`
67+
| help: must be of the form: `#[repr(C | Rust | align(...) | packed(...) | <integer type> | transparent)]`
6868

6969
error[E0518]: attribute should be applied to function or closure
7070
--> $DIR/issue-43988.rs:5:5

tests/ui/repr/repr.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | #[repr]
55
| ^^^^^^^
66
| |
77
| expected this to be a list
8-
| help: must be of the form: `#[repr(C)]`
8+
| help: must be of the form: `#[repr(C | Rust | align(...) | packed(...) | <integer type> | transparent)]`
99

1010
error[E0539]: malformed `repr` attribute input
1111
--> $DIR/repr.rs:4:1
@@ -14,7 +14,7 @@ LL | #[repr = "B"]
1414
| ^^^^^^^^^^^^^
1515
| |
1616
| expected this to be a list
17-
| help: must be of the form: `#[repr(C)]`
17+
| help: must be of the form: `#[repr(C | Rust | align(...) | packed(...) | <integer type> | transparent)]`
1818

1919
error[E0539]: malformed `repr` attribute input
2020
--> $DIR/repr.rs:7:1
@@ -23,7 +23,7 @@ LL | #[repr = "C"]
2323
| ^^^^^^^^^^^^^
2424
| |
2525
| expected this to be a list
26-
| help: must be of the form: `#[repr(C)]`
26+
| help: must be of the form: `#[repr(C | Rust | align(...) | packed(...) | <integer type> | transparent)]`
2727

2828
error: aborting due to 3 previous errors
2929

0 commit comments

Comments
 (0)