]> git.lizzy.rs Git - rust.git/commitdiff
Add long error explanation for E0634 #61137
authorAyush Kumar Mishra <ayush.k.mishra@xcelenergy.com>
Sat, 14 Mar 2020 10:31:03 +0000 (16:01 +0530)
committerAyush Kumar Mishra <ayush.k.mishra@xcelenergy.com>
Sat, 14 Mar 2020 10:31:03 +0000 (16:01 +0530)
src/librustc_error_codes/error_codes.rs
src/librustc_error_codes/error_codes/E0634.md [new file with mode: 0644]
src/test/ui/conflicting-repr-hints.stderr

index 11d1209923fb2912020c837c7735bde7ac2c391a..eba18c5a005d08621f39aef1042a803693e9b187 100644 (file)
 E0627: include_str!("./error_codes/E0627.md"),
 E0631: include_str!("./error_codes/E0631.md"),
 E0633: include_str!("./error_codes/E0633.md"),
+E0634: include_str!("./error_codes/E0634.md"),
 E0635: include_str!("./error_codes/E0635.md"),
 E0636: include_str!("./error_codes/E0636.md"),
 E0637: include_str!("./error_codes/E0637.md"),
     E0630,
     E0632, // cannot provide explicit generic arguments when `impl Trait` is
            // used in argument position
-    E0634, // type has conflicting packed representaton hints
     E0640, // infer outlives requirements
 //  E0645, // trait aliases not finished
     E0657, // `impl Trait` can only capture lifetimes bound at the fn level
diff --git a/src/librustc_error_codes/error_codes/E0634.md b/src/librustc_error_codes/error_codes/E0634.md
new file mode 100644 (file)
index 0000000..5057aa6
--- /dev/null
@@ -0,0 +1,20 @@
+A type has conflicting `packed` representation hint.
+
+Erroneous code examples:
+
+```compile_fail,E0634
+#[repr(packed, packed(2))] // error!
+struct Company(i32);
+
+#[repr(packed(2))] // error!
+#[repr(packed)]
+struct Company(i32);
+```
+
+You cannot use conflicting `packed` hint 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 Company(i32);
+```
index 43b76bf649778ec84706635c4796ca4caac24ed9..0b78532c73751fbf9298b29445e88a643ad508a3 100644 (file)
@@ -76,5 +76,5 @@ LL | | }
 
 error: aborting due to 10 previous errors
 
-Some errors have detailed explanations: E0566, E0587.
+Some errors have detailed explanations: E0566, E0587, E0634.
 For more information about an error, try `rustc --explain E0566`.