Skip to content

Commit c5e0d6e

Browse files
Add long error explanation for E0566
1 parent 5a8fb7c commit c5e0d6e

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

src/librustc/error_codes.rs

+24-1
Original file line numberDiff line numberDiff line change
@@ -1700,6 +1700,30 @@ 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+
```compile_fail,E0566
1709+
# #![deny(warnings)]
1710+
# fn main() {
1711+
#[repr(u32, u64)] // error!
1712+
enum Repr { A }
1713+
# }
1714+
```
1715+
1716+
In most cases (if not all), using just one representation hint is more than
1717+
enough. If you want to have a representation hint depending on the current
1718+
architecture, use `cfg_attr`. Example:
1719+
1720+
```
1721+
#[cfg_attr(linux, repr(u32))]
1722+
#[cfg_attr(not(linux), repr(u64))]
1723+
enum Repr { A }
1724+
```
1725+
"##,
1726+
17031727
E0580: r##"
17041728
The `main` function was incorrectly declared.
17051729
@@ -2097,7 +2121,6 @@ rejected in your own crates.
20972121
E0490, // a value of type `..` is borrowed for too long
20982122
E0495, // cannot infer an appropriate lifetime due to conflicting
20992123
// requirements
2100-
E0566, // conflicting representation hints
21012124
E0623, // lifetime mismatch where both parameters are anonymous regions
21022125
E0628, // generators cannot have explicit parameters
21032126
E0631, // type mismatch in closure arguments

0 commit comments

Comments
 (0)