Skip to content

Commit 76b8fd8

Browse files
Add long error explanation for E0587
1 parent f466f52 commit 76b8fd8

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/librustc_typeck/error_codes.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3891,6 +3891,25 @@ details.
38913891
[issue #33685]: https://github.com/rust-lang/rust/issues/33685
38923892
"##,
38933893

3894+
E0587: r##"
3895+
A type has both `packed` and `align` representation hints.
3896+
3897+
Erroneous code example:
3898+
3899+
```compile_fail,E0587
3900+
#[repr(packed, align(8))] // error!
3901+
struct Umbrella(i32);
3902+
```
3903+
3904+
You cannot use `packed` and `align` hints on a same type. If you want to pack a
3905+
type to a given size, you should provide a size to packed:
3906+
3907+
```
3908+
#[repr(packed)] // ok!
3909+
struct Umbrella(i32);
3910+
```
3911+
"##,
3912+
38943913
E0588: r##"
38953914
A type with `packed` representation hint has a field with `align`
38963915
representation hint.
@@ -5073,7 +5092,6 @@ the future, [RFC 2091] prohibits their implementation without a follow-up RFC.
50735092
// E0563, // cannot determine a type for this `impl Trait` removed in 6383de15
50745093
// E0564, // only named lifetimes are allowed in `impl Trait`,
50755094
// but `{}` was found in the type `{}`
5076-
E0587, // type has conflicting packed and align representation hints
50775095
// E0611, // merged into E0616
50785096
// E0612, // merged into E0609
50795097
// E0613, // Removed (merged with E0609)

0 commit comments

Comments
 (0)