Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add long error explanation for E0588 #65591

Merged
merged 3 commits into from
Oct 23, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion src/librustc_typeck/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3891,6 +3891,33 @@ details.
[issue #33685]: https://github.com/rust-lang/rust/issues/33685
"##,

E0588: r##"
A type with `packed` representation hint has a field with `align`
representation hint.

Erroneous code example:

```compile_fail,E0588
#[repr(align(16))]
struct Aligned(i32);

#[repr(packed)] // error!
struct Packed(Aligned);
```

Just like you can't have both `align` and `packed` representation hints on a
Dylan-DPC-zz marked this conversation as resolved.
Show resolved Hide resolved
same type, a `packed` type can't contain another type with the `align`
Dylan-DPC-zz marked this conversation as resolved.
Show resolved Hide resolved
representation hint. However, you can do the opposite:

```
#[repr(packed)]
struct Packed(i32);

#[repr(align(16))] // ok!
struct Aligned(Packed);
```
"##,

E0592: r##"
This error occurs when you defined methods or associated functions with same
name.
Expand Down Expand Up @@ -5043,7 +5070,6 @@ the future, [RFC 2091] prohibits their implementation without a follow-up RFC.
// E0564, // only named lifetimes are allowed in `impl Trait`,
// but `{}` was found in the type `{}`
E0587, // type has conflicting packed and align representation hints
E0588, // packed type cannot transitively contain a `[repr(align)]` type
// E0611, // merged into E0616
// E0612, // merged into E0609
// E0613, // Removed (merged with E0609)
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/repr/repr-packed-contains-align.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@ LL | | }

error: aborting due to 8 previous errors

For more information about this error, try `rustc --explain E0588`.