mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 18:23:49 +00:00
20c833c632
The two altered expectation messages both seem like improvements: - `coerce-expect-unsized-ascribed.stderr` says you can go `Box<char> -> Box<dyn Debug>`, which you can. - `upcast_soundness_bug.stderr` used to say that you could go `Box<dyn Trait<u8, u8>> -> Box<dyn Trait>`, which you can't, because the type parameters are missing in the destination and the only ones that work aren't what's needed.
134 lines
6.1 KiB
Plaintext
134 lines
6.1 KiB
Plaintext
error[E0308]: mismatched types
|
|
--> $DIR/coerce-expect-unsized-ascribed.rs:9:27
|
|
|
|
|
LL | let _ = type_ascribe!(Box::new({ [1, 2, 3] }), Box<[i32]>);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<[i32]>`, found `Box<[i32; 3]>`
|
|
|
|
|
= note: expected struct `Box<[i32]>`
|
|
found struct `Box<[i32; 3]>`
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/coerce-expect-unsized-ascribed.rs:10:27
|
|
|
|
|
LL | let _ = type_ascribe!(Box::new( if true { [1, 2, 3] } else { [1, 3, 4] }), Box<[i32]>);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<[i32]>`, found `Box<[i32; 3]>`
|
|
|
|
|
= note: expected struct `Box<[i32]>`
|
|
found struct `Box<[i32; 3]>`
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/coerce-expect-unsized-ascribed.rs:12:9
|
|
|
|
|
LL | Box::new( match true { true => [1, 2, 3], false => [1, 3, 4] }), Box<[i32]>);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<[i32]>`, found `Box<[i32; 3]>`
|
|
|
|
|
= note: expected struct `Box<[i32]>`
|
|
found struct `Box<[i32; 3]>`
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/coerce-expect-unsized-ascribed.rs:14:27
|
|
|
|
|
LL | let _ = type_ascribe!(Box::new( { |x| (x as u8) }), Box<dyn Fn(i32) -> _>);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<dyn Fn(i32) -> u8>`, found `Box<{closure@coerce-expect-unsized-ascribed.rs:14:39}>`
|
|
|
|
|
= note: expected struct `Box<dyn Fn(i32) -> u8>`
|
|
found struct `Box<{closure@$DIR/coerce-expect-unsized-ascribed.rs:14:39: 14:42}>`
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/coerce-expect-unsized-ascribed.rs:15:27
|
|
|
|
|
LL | let _ = type_ascribe!(Box::new( if true { false } else { true }), Box<dyn Debug>);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<dyn Debug>`, found `Box<bool>`
|
|
|
|
|
= note: expected struct `Box<dyn Debug>`
|
|
found struct `Box<bool>`
|
|
= help: `bool` implements `Debug` so you could box the found value and coerce it to the trait object `Box<dyn Debug>`, you will have to change the expected type as well
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/coerce-expect-unsized-ascribed.rs:16:27
|
|
|
|
|
LL | let _ = type_ascribe!(Box::new( match true { true => 'a', false => 'b' }), Box<dyn Debug>);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<dyn Debug>`, found `Box<char>`
|
|
|
|
|
= note: expected struct `Box<dyn Debug>`
|
|
found struct `Box<char>`
|
|
= help: `char` implements `Debug` so you could box the found value and coerce it to the trait object `Box<dyn Debug>`, you will have to change the expected type as well
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/coerce-expect-unsized-ascribed.rs:18:27
|
|
|
|
|
LL | let _ = type_ascribe!(&{ [1, 2, 3] }, &[i32]);
|
|
| ^^^^^^^^^^^^^^ expected `&[i32]`, found `&[i32; 3]`
|
|
|
|
|
= note: expected reference `&[i32]`
|
|
found reference `&[i32; 3]`
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/coerce-expect-unsized-ascribed.rs:19:27
|
|
|
|
|
LL | let _ = type_ascribe!(&if true { [1, 2, 3] } else { [1, 3, 4] }, &[i32]);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&[i32]`, found `&[i32; 3]`
|
|
|
|
|
= note: expected reference `&[i32]`
|
|
found reference `&[i32; 3]`
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/coerce-expect-unsized-ascribed.rs:20:27
|
|
|
|
|
LL | let _ = type_ascribe!(&match true { true => [1, 2, 3], false => [1, 3, 4] }, &[i32]);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&[i32]`, found `&[i32; 3]`
|
|
|
|
|
= note: expected reference `&[i32]`
|
|
found reference `&[i32; 3]`
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/coerce-expect-unsized-ascribed.rs:22:27
|
|
|
|
|
LL | let _ = type_ascribe!(&{ |x| (x as u8) }, &dyn Fn(i32) -> _);
|
|
| ^^^^^^^^^^^^^^^^^^ expected `&dyn Fn(i32) -> u8`, found `&{closure@coerce-expect-unsized-ascribed.rs:22:30}`
|
|
|
|
|
= note: expected reference `&dyn Fn(i32) -> u8`
|
|
found reference `&{closure@$DIR/coerce-expect-unsized-ascribed.rs:22:30: 22:33}`
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/coerce-expect-unsized-ascribed.rs:23:27
|
|
|
|
|
LL | let _ = type_ascribe!(&if true { false } else { true }, &dyn Debug);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&dyn Debug`, found `&bool`
|
|
|
|
|
= note: expected reference `&dyn Debug`
|
|
found reference `&bool`
|
|
= help: `bool` implements `Debug` so you could box the found value and coerce it to the trait object `Box<dyn Debug>`, you will have to change the expected type as well
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/coerce-expect-unsized-ascribed.rs:24:27
|
|
|
|
|
LL | let _ = type_ascribe!(&match true { true => 'a', false => 'b' }, &dyn Debug);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&dyn Debug`, found `&char`
|
|
|
|
|
= note: expected reference `&dyn Debug`
|
|
found reference `&char`
|
|
= help: `char` implements `Debug` so you could box the found value and coerce it to the trait object `Box<dyn Debug>`, you will have to change the expected type as well
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/coerce-expect-unsized-ascribed.rs:26:27
|
|
|
|
|
LL | let _ = type_ascribe!(Box::new([1, 2, 3]), Box<[i32]>);
|
|
| ^^^^^^^^^^^^^^^^^^^ expected `Box<[i32]>`, found `Box<[i32; 3]>`
|
|
|
|
|
= note: expected struct `Box<[i32]>`
|
|
found struct `Box<[i32; 3]>`
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/coerce-expect-unsized-ascribed.rs:27:27
|
|
|
|
|
LL | let _ = type_ascribe!(Box::new(|x| (x as u8)), Box<dyn Fn(i32) -> _>);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<dyn Fn(i32) -> u8>`, found `Box<{closure@coerce-expect-unsized-ascribed.rs:27:36}>`
|
|
|
|
|
= note: expected struct `Box<dyn Fn(i32) -> u8>`
|
|
found struct `Box<{closure@$DIR/coerce-expect-unsized-ascribed.rs:27:36: 27:39}>`
|
|
|
|
error: aborting due to 14 previous errors
|
|
|
|
For more information about this error, try `rustc --explain E0308`.
|