forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#121900 - chenyukang:yukang-fix-121425-repr-pa…
…ck-error, r=compiler-errors Fix misleading message in struct repr alignment and packed Fixes rust-lang#121425 By the way, fix the spans for the argument in the second commit.
- Loading branch information
Showing
9 changed files
with
160 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//@ compile-flags: -Zdeduplicate-diagnostics=yes | ||
|
||
const N: usize = 8; | ||
#[repr(align(N))] | ||
//~^ ERROR: incorrect `repr(align)` attribute format | ||
struct T; | ||
|
||
#[repr(align('a'))] | ||
//~^ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer [E0589] | ||
struct H; | ||
|
||
#[repr(align("str"))] | ||
//~^ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer [E0589] | ||
struct L; | ||
|
||
#[repr(align())] | ||
//~^ ERROR: attribute format: `align` takes exactly one argument in parentheses | ||
struct X; | ||
|
||
const P: usize = 8; | ||
#[repr(packed(P))] | ||
//~^ ERROR: attribute format: `packed` expects a literal integer as argument | ||
struct A; | ||
|
||
#[repr(packed())] | ||
//~^ ERROR: attribute format: `packed` takes exactly one parenthesized argument, or no parentheses at all | ||
struct B; | ||
|
||
#[repr(packed)] | ||
struct C; | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
error[E0693]: incorrect `repr(align)` attribute format: `align` expects a literal integer as argument | ||
--> $DIR/arg-error-issue-121425.rs:4:14 | ||
| | ||
LL | #[repr(align(N))] | ||
| ^ | ||
|
||
error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer | ||
--> $DIR/arg-error-issue-121425.rs:8:14 | ||
| | ||
LL | #[repr(align('a'))] | ||
| ^^^ | ||
|
||
error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer | ||
--> $DIR/arg-error-issue-121425.rs:12:14 | ||
| | ||
LL | #[repr(align("str"))] | ||
| ^^^^^ | ||
|
||
error[E0693]: incorrect `repr(align)` attribute format: `align` takes exactly one argument in parentheses | ||
--> $DIR/arg-error-issue-121425.rs:16:8 | ||
| | ||
LL | #[repr(align())] | ||
| ^^^^^^^ | ||
|
||
error[E0552]: incorrect `repr(packed)` attribute format: `packed` expects a literal integer as argument | ||
--> $DIR/arg-error-issue-121425.rs:21:15 | ||
| | ||
LL | #[repr(packed(P))] | ||
| ^ | ||
|
||
error[E0552]: incorrect `repr(packed)` attribute format: `packed` takes exactly one parenthesized argument, or no parentheses at all | ||
--> $DIR/arg-error-issue-121425.rs:25:8 | ||
| | ||
LL | #[repr(packed())] | ||
| ^^^^^^^^ | ||
|
||
error: aborting due to 6 previous errors | ||
|
||
Some errors have detailed explanations: E0552, E0589, E0693. | ||
For more information about an error, try `rustc --explain E0552`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters