Skip to content

Commit

Permalink
Auto merge of #66206 - PotHix:master, r=estebank
Browse files Browse the repository at this point in the history
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: #61286.
  • Loading branch information
bors committed Nov 19, 2019
2 parents d1da802 + 3fa8692 commit 2cad8bb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/libsyntax/feature_gate/builtin_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
),
ungated!(link_name, Whitelisted, template!(NameValueStr: "name")),
ungated!(no_link, Normal, template!(Word)),
ungated!(repr, Normal, template!(List: "C, packed, ...")),
ungated!(repr, Normal, template!(List: "C")),
ungated!(export_name, Whitelisted, template!(NameValueStr: "name")),
ungated!(link_section, Whitelisted, template!(NameValueStr: "name")),
ungated!(no_mangle, Whitelisted, template!(Word)),
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/issues/issue-43988.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ error: malformed `repr` attribute input
--> $DIR/issue-43988.rs:24:5
|
LL | #[repr]
| ^^^^^^^ help: must be of the form: `#[repr(C, packed, ...)]`
| ^^^^^^^ help: must be of the form: `#[repr(C)]`

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

error[E0518]: attribute should be applied to function or closure
--> $DIR/issue-43988.rs:5:5
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/repr.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ error: malformed `repr` attribute input
--> $DIR/repr.rs:1:1
|
LL | #[repr]
| ^^^^^^^ help: must be of the form: `#[repr(C, packed, ...)]`
| ^^^^^^^ help: must be of the form: `#[repr(C)]`

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

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

error: aborting due to 3 previous errors

0 comments on commit 2cad8bb

Please sign in to comment.