Skip to content

Commit 3fa8692

Browse files
committed
Suggest #[repr(C)] instead of #[repr(C, packed, ...)]
The code was previously suggesting `#[repr(C, packed, ...)]` for incorrect uses of `repr` (e.g. `#[repr = "C"]`). This change suggests the usage of `#[repr(C)]` instead. r? @estebank ref rust-lang#61286
1 parent e8f43b7 commit 3fa8692

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/libsyntax/feature_gate/builtin_attrs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
231231
),
232232
ungated!(link_name, Whitelisted, template!(NameValueStr: "name")),
233233
ungated!(no_link, Normal, template!(Word)),
234-
ungated!(repr, Normal, template!(List: "C, packed, ...")),
234+
ungated!(repr, Normal, template!(List: "C")),
235235
ungated!(export_name, Whitelisted, template!(NameValueStr: "name")),
236236
ungated!(link_section, Whitelisted, template!(NameValueStr: "name")),
237237
ungated!(no_mangle, Whitelisted, template!(Word)),

src/test/ui/issues/issue-43988.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ error: malformed `repr` attribute input
22
--> $DIR/issue-43988.rs:24:5
33
|
44
LL | #[repr]
5-
| ^^^^^^^ help: must be of the form: `#[repr(C, packed, ...)]`
5+
| ^^^^^^^ help: must be of the form: `#[repr(C)]`
66

77
error: malformed `repr` attribute input
88
--> $DIR/issue-43988.rs:35:14
99
|
1010
LL | let _z = #[repr] 1;
11-
| ^^^^^^^ help: must be of the form: `#[repr(C, packed, ...)]`
11+
| ^^^^^^^ help: must be of the form: `#[repr(C)]`
1212

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

src/test/ui/repr.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ error: malformed `repr` attribute input
22
--> $DIR/repr.rs:1:1
33
|
44
LL | #[repr]
5-
| ^^^^^^^ help: must be of the form: `#[repr(C, packed, ...)]`
5+
| ^^^^^^^ help: must be of the form: `#[repr(C)]`
66

77
error: malformed `repr` attribute input
88
--> $DIR/repr.rs:4:1
99
|
1010
LL | #[repr = "B"]
11-
| ^^^^^^^^^^^^^ help: must be of the form: `#[repr(C, packed, ...)]`
11+
| ^^^^^^^^^^^^^ help: must be of the form: `#[repr(C)]`
1212

1313
error: malformed `repr` attribute input
1414
--> $DIR/repr.rs:7:1
1515
|
1616
LL | #[repr = "C"]
17-
| ^^^^^^^^^^^^^ help: must be of the form: `#[repr(C, packed, ...)]`
17+
| ^^^^^^^^^^^^^ help: must be of the form: `#[repr(C)]`
1818

1919
error: aborting due to 3 previous errors
2020

0 commit comments

Comments
 (0)