Skip to content

Commit eec3a9c

Browse files
authored
Rollup merge of #65563 - GuillaumeGomez:long-err-explanation-E0587, r=Dylan-DPC
Add long error explanation for E0587 Part of #61137. r? @kinnison
2 parents 8d78bf6 + 42a805e commit eec3a9c

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/librustc_typeck/error_codes.rs

+19-1
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.
@@ -5098,7 +5117,6 @@ struct B<const X: A>; // ok!
50985117
// E0563, // cannot determine a type for this `impl Trait` removed in 6383de15
50995118
// E0564, // only named lifetimes are allowed in `impl Trait`,
51005119
// but `{}` was found in the type `{}`
5101-
E0587, // type has conflicting packed and align representation hints
51025120
// E0611, // merged into E0616
51035121
// E0612, // merged into E0609
51045122
// E0613, // Removed (merged with E0609)

src/test/ui/conflicting-repr-hints.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,5 @@ LL | | }
6666

6767
error: aborting due to 8 previous errors
6868

69-
For more information about this error, try `rustc --explain E0566`.
69+
Some errors have detailed explanations: E0566, E0587.
70+
For more information about an error, try `rustc --explain E0566`.

0 commit comments

Comments
 (0)