about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2019-10-06 15:23:33 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2019-10-06 15:23:33 +0200
commitc5e0d6e4d43f228687c75ab7406f64b318752d7b (patch)
treec7f35e17a7018f2c076c4eb7d9b0d3e9d427a3e2
parent5a8fb7c24d85d0bd911ca465c4a077c7cee608ae (diff)
downloadrust-c5e0d6e4d43f228687c75ab7406f64b318752d7b.tar.gz
rust-c5e0d6e4d43f228687c75ab7406f64b318752d7b.zip
Add long error explanation for E0566
-rw-r--r--src/librustc/error_codes.rs25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/librustc/error_codes.rs b/src/librustc/error_codes.rs
index 66c51000066..9a5e1ea6f33 100644
--- a/src/librustc/error_codes.rs
+++ b/src/librustc/error_codes.rs
@@ -1700,6 +1700,30 @@ To understand better how closures work in Rust, read:
 https://doc.rust-lang.org/book/ch13-01-closures.html
 "##,
 
+E0566: r##"
+Conflicting representation hints have been used on a same item.
+
+Erroneous code example:
+
+```compile_fail,E0566
+# #![deny(warnings)]
+# fn main() {
+#[repr(u32, u64)] // error!
+enum Repr { A }
+# }
+```
+
+In most cases (if not all), using just one representation hint is more than
+enough. If you want to have a representation hint depending on the current
+architecture, use `cfg_attr`. Example:
+
+```
+#[cfg_attr(linux, repr(u32))]
+#[cfg_attr(not(linux), repr(u64))]
+enum Repr { A }
+```
+"##,
+
 E0580: r##"
 The `main` function was incorrectly declared.
 
@@ -2097,7 +2121,6 @@ rejected in your own crates.
     E0490, // a value of type `..` is borrowed for too long
     E0495, // cannot infer an appropriate lifetime due to conflicting
            // requirements
-    E0566, // conflicting representation hints
     E0623, // lifetime mismatch where both parameters are anonymous regions
     E0628, // generators cannot have explicit parameters
     E0631, // type mismatch in closure arguments