about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-10-28 21:35:56 +0100
committerGitHub <noreply@github.com>2019-10-28 21:35:56 +0100
commiteec3a9c4af5067c37f5b681599a48b4e21098260 (patch)
treef1070368ea3f32adf4e417f4cf1063a6e64ea758
parent8d78bf6b273848d17da8f5c92162c6a6b9b10dfd (diff)
parent42a805e4d2b057f58f5ad72b35afaee1bf8358ef (diff)
downloadrust-eec3a9c4af5067c37f5b681599a48b4e21098260.tar.gz
rust-eec3a9c4af5067c37f5b681599a48b4e21098260.zip
Rollup merge of #65563 - GuillaumeGomez:long-err-explanation-E0587, r=Dylan-DPC
Add long error explanation for E0587

Part of #61137.

r? @kinnison
-rw-r--r--src/librustc_typeck/error_codes.rs20
-rw-r--r--src/test/ui/conflicting-repr-hints.stderr3
2 files changed, 21 insertions, 2 deletions
diff --git a/src/librustc_typeck/error_codes.rs b/src/librustc_typeck/error_codes.rs
index ae67f54ac12..248b687c31c 100644
--- a/src/librustc_typeck/error_codes.rs
+++ b/src/librustc_typeck/error_codes.rs
@@ -3891,6 +3891,25 @@ details.
 [issue #33685]: https://github.com/rust-lang/rust/issues/33685
 "##,
 
+E0587: r##"
+A type has both `packed` and `align` representation hints.
+
+Erroneous code example:
+
+```compile_fail,E0587
+#[repr(packed, align(8))] // error!
+struct Umbrella(i32);
+```
+
+You cannot use `packed` and `align` hints on a same type. If you want to pack a
+type to a given size, you should provide a size to packed:
+
+```
+#[repr(packed)] // ok!
+struct Umbrella(i32);
+```
+"##,
+
 E0588: r##"
 A type with `packed` representation hint has a field with `align`
 representation hint.
@@ -5098,7 +5117,6 @@ struct B<const X: A>; // ok!
 //  E0563, // cannot determine a type for this `impl Trait` removed in 6383de15
 //  E0564, // only named lifetimes are allowed in `impl Trait`,
            // but `{}` was found in the type `{}`
-    E0587, // type has conflicting packed and align representation hints
 //  E0611, // merged into E0616
 //  E0612, // merged into E0609
 //  E0613, // Removed (merged with E0609)
diff --git a/src/test/ui/conflicting-repr-hints.stderr b/src/test/ui/conflicting-repr-hints.stderr
index 832f5c3ac2b..414c15f93bc 100644
--- a/src/test/ui/conflicting-repr-hints.stderr
+++ b/src/test/ui/conflicting-repr-hints.stderr
@@ -66,4 +66,5 @@ LL | | }
 
 error: aborting due to 8 previous errors
 
-For more information about this error, try `rustc --explain E0566`.
+Some errors have detailed explanations: E0566, E0587.
+For more information about an error, try `rustc --explain E0566`.