diff options
| author | Ayush Kumar Mishra <ayush.k.mishra@xcelenergy.com> | 2020-03-14 16:01:03 +0530 |
|---|---|---|
| committer | Ayush Kumar Mishra <ayush.k.mishra@xcelenergy.com> | 2020-03-14 16:01:03 +0530 |
| commit | 4bd6ebcc31bc68925742d2cb21095b5c76e7976c (patch) | |
| tree | bf7cdecf17124e426400ce32dd0d41c122bf6958 /src | |
| parent | 3dbade652ed8ebac70f903e01f51cd92c4e4302c (diff) | |
| download | rust-4bd6ebcc31bc68925742d2cb21095b5c76e7976c.tar.gz rust-4bd6ebcc31bc68925742d2cb21095b5c76e7976c.zip | |
Add long error explanation for E0634 #61137
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_error_codes/error_codes.rs | 2 | ||||
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0634.md | 20 | ||||
| -rw-r--r-- | src/test/ui/conflicting-repr-hints.stderr | 2 |
3 files changed, 22 insertions, 2 deletions
diff --git a/src/librustc_error_codes/error_codes.rs b/src/librustc_error_codes/error_codes.rs index 11d1209923f..eba18c5a005 100644 --- a/src/librustc_error_codes/error_codes.rs +++ b/src/librustc_error_codes/error_codes.rs @@ -351,6 +351,7 @@ E0626: include_str!("./error_codes/E0626.md"), 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"), @@ -587,7 +588,6 @@ E0748: include_str!("./error_codes/E0748.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 index 00000000000..5057aa6094e --- /dev/null +++ b/src/librustc_error_codes/error_codes/E0634.md @@ -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); +``` diff --git a/src/test/ui/conflicting-repr-hints.stderr b/src/test/ui/conflicting-repr-hints.stderr index 43b76bf6497..0b78532c737 100644 --- a/src/test/ui/conflicting-repr-hints.stderr +++ b/src/test/ui/conflicting-repr-hints.stderr @@ -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`. |
