Skip to content

Commit

Permalink
Rollup merge of rust-lang#65591 - GuillaumeGomez:long-err-explanation…
Browse files Browse the repository at this point in the history
…-E0588, r=Dylan-DPC

Add long error explanation for E0588

Part of rust-lang#61137.

r? @kinnison
  • Loading branch information
JohnTitor committed Oct 23, 2019
2 parents 1dbb010 + 07f2f05 commit 6f6f3e8
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
38 changes: 32 additions & 6 deletions src/librustc_typeck/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ a guard.
```compile_fail,E0029
let string = "salutations !";
// The ordering relation for strings can't be evaluated at compile time,
// The ordering relation for strings cannot be evaluated at compile time,
// so this doesn't work:
match string {
"hello" ..= "world" => {}
Expand Down Expand Up @@ -348,7 +348,7 @@ fn main() {
"##,

E0044: r##"
You can't use type or const parameters on foreign items.
You cannot use type or const parameters on foreign items.
Example of erroneous code:
```compile_fail,E0044
Expand Down Expand Up @@ -788,7 +788,7 @@ fn some_other_func() {}
fn some_function() {
SOME_CONST = 14; // error : a constant value cannot be changed!
1 = 3; // error : 1 isn't a valid place!
some_other_func() = 4; // error : we can't assign value to a function!
some_other_func() = 4; // error : we cannot assign value to a function!
SomeStruct.x = 12; // error : SomeStruct a structure name but it is used
// like a variable!
}
Expand Down Expand Up @@ -3891,6 +3891,33 @@ details.
[issue #33685]: https://github.com/rust-lang/rust/issues/33685
"##,

E0588: r##"
A type with `packed` representation hint has a field with `align`
representation hint.
Erroneous code example:
```compile_fail,E0588
#[repr(align(16))]
struct Aligned(i32);
#[repr(packed)] // error!
struct Packed(Aligned);
```
Just like you cannot have both `align` and `packed` representation hints on a
same type, a `packed` type cannot contain another type with the `align`
representation hint. However, you can do the opposite:
```
#[repr(packed)]
struct Packed(i32);
#[repr(align(16))] // ok!
struct Aligned(Packed);
```
"##,

E0592: r##"
This error occurs when you defined methods or associated functions with same
name.
Expand Down Expand Up @@ -4299,7 +4326,7 @@ extern {
unsafe {
printf(::std::ptr::null(), 0f32);
// error: can't pass an `f32` to variadic function, cast to `c_double`
// error: cannot pass an `f32` to variadic function, cast to `c_double`
}
```
Expand Down Expand Up @@ -5000,7 +5027,7 @@ the future, [RFC 2091] prohibits their implementation without a follow-up RFC.
// E0174,
// E0182, // merged into E0229
E0183,
// E0187, // can't infer the kind of the closure
// E0187, // cannot infer the kind of the closure
// E0188, // can not cast an immutable reference to a mutable pointer
// E0189, // deprecated: can only cast a boxed pointer to a boxed object
// E0190, // deprecated: can only cast a &-pointer to an &-object
Expand Down Expand Up @@ -5047,7 +5074,6 @@ the future, [RFC 2091] prohibits their implementation without a follow-up RFC.
// E0564, // only named lifetimes are allowed in `impl Trait`,
// but `{}` was found in the type `{}`
E0587, // type has conflicting packed and align representation hints
E0588, // packed type cannot transitively contain a `[repr(align)]` type
// E0611, // merged into E0616
// E0612, // merged into E0609
// E0613, // Removed (merged with E0609)
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/repr/repr-packed-contains-align.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@ LL | | }

error: aborting due to 8 previous errors

For more information about this error, try `rustc --explain E0588`.

0 comments on commit 6f6f3e8

Please sign in to comment.