Skip to content

Commit 00315c3

Browse files
authored
Rollup merge of rust-lang#65164 - GuillaumeGomez:long-err-explanation-E0566, r=estebank
Add long error explanation for E0566 Part of rust-lang#61137.
2 parents 934f3c2 + 57cb881 commit 00315c3

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

src/librustc/error_codes.rs

+21-1
Original file line numberDiff line numberDiff line change
@@ -1700,6 +1700,27 @@ To understand better how closures work in Rust, read:
17001700
https://doc.rust-lang.org/book/ch13-01-closures.html
17011701
"##,
17021702

1703+
E0566: r##"
1704+
Conflicting representation hints have been used on a same item.
1705+
1706+
Erroneous code example:
1707+
1708+
```
1709+
#[repr(u32, u64)] // warning!
1710+
enum Repr { A }
1711+
```
1712+
1713+
In most cases (if not all), using just one representation hint is more than
1714+
enough. If you want to have a representation hint depending on the current
1715+
architecture, use `cfg_attr`. Example:
1716+
1717+
```
1718+
#[cfg_attr(linux, repr(u32))]
1719+
#[cfg_attr(not(linux), repr(u64))]
1720+
enum Repr { A }
1721+
```
1722+
"##,
1723+
17031724
E0580: r##"
17041725
The `main` function was incorrectly declared.
17051726
@@ -2097,7 +2118,6 @@ rejected in your own crates.
20972118
E0490, // a value of type `..` is borrowed for too long
20982119
E0495, // cannot infer an appropriate lifetime due to conflicting
20992120
// requirements
2100-
E0566, // conflicting representation hints
21012121
E0623, // lifetime mismatch where both parameters are anonymous regions
21022122
E0628, // generators cannot have explicit parameters
21032123
E0631, // type mismatch in closure arguments

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

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

6767
error: aborting due to 8 previous errors
6868

69+
For more information about this error, try `rustc --explain E0566`.

src/test/ui/feature-gates/feature-gate-repr-simd.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ LL | #[repr(simd)]
2626

2727
error: aborting due to 2 previous errors
2828

29-
For more information about this error, try `rustc --explain E0658`.
29+
Some errors have detailed explanations: E0566, E0658.
30+
For more information about an error, try `rustc --explain E0566`.

0 commit comments

Comments
 (0)