rust/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr

130 lines
5.3 KiB
Plaintext
Raw Normal View History

2018-08-08 07:28:26 -05:00
error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:19:13
|
LL | let _ = box { [1, 2, 3] }: Box<[i32]>; //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
|
= note: expected type `std::boxed::Box<[i32]>`
found type `std::boxed::Box<[i32; 3]>`
error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:20:13
|
LL | let _ = box if true { [1, 2, 3] } else { [1, 3, 4] }: Box<[i32]>; //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
|
= note: expected type `std::boxed::Box<[i32]>`
found type `std::boxed::Box<[i32; 3]>`
error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:21:13
|
LL | let _ = box match true { true => [1, 2, 3], false => [1, 3, 4] }: Box<[i32]>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
|
= note: expected type `std::boxed::Box<[i32]>`
found type `std::boxed::Box<[i32; 3]>`
error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:23:13
|
LL | let _ = box { |x| (x as u8) }: Box<Fn(i32) -> _>; //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure
|
= note: expected type `std::boxed::Box<dyn std::ops::Fn(i32) -> u8>`
found type `std::boxed::Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:23:19: 23:32]>`
error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:24:13
|
LL | let _ = box if true { false } else { true }: Box<Debug>; //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found bool
|
= note: expected type `std::boxed::Box<dyn std::fmt::Debug>`
found type `std::boxed::Box<bool>`
error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:25:13
|
LL | let _ = box match true { true => 'a', false => 'b' }: Box<Debug>; //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found char
|
= note: expected type `std::boxed::Box<dyn std::fmt::Debug>`
found type `std::boxed::Box<char>`
error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:27:13
|
LL | let _ = &{ [1, 2, 3] }: &[i32]; //~ ERROR mismatched types
| ^^^^^^^^^^^^^^ expected slice, found array of 3 elements
|
= note: expected type `&[i32]`
found type `&[i32; 3]`
error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:28:13
|
LL | let _ = &if true { [1, 2, 3] } else { [1, 3, 4] }: &[i32]; //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
|
= note: expected type `&[i32]`
found type `&[i32; 3]`
error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:29:13
|
LL | let _ = &match true { true => [1, 2, 3], false => [1, 3, 4] }: &[i32];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
|
= note: expected type `&[i32]`
found type `&[i32; 3]`
error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:31:13
|
LL | let _ = &{ |x| (x as u8) }: &Fn(i32) -> _; //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure
|
= note: expected type `&dyn std::ops::Fn(i32) -> u8`
found type `&[closure@$DIR/coerce-expect-unsized-ascribed.rs:31:16: 31:29]`
error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:32:13
|
LL | let _ = &if true { false } else { true }: &Debug; //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found bool
|
= note: expected type `&dyn std::fmt::Debug`
found type `&bool`
error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:33:13
|
LL | let _ = &match true { true => 'a', false => 'b' }: &Debug; //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found char
|
= note: expected type `&dyn std::fmt::Debug`
found type `&char`
error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:35:13
|
LL | let _ = Box::new([1, 2, 3]): Box<[i32]>; //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
|
= note: expected type `std::boxed::Box<[i32]>`
found type `std::boxed::Box<[i32; 3]>`
error[E0308]: mismatched types
--> $DIR/coerce-expect-unsized-ascribed.rs:36:13
|
LL | let _ = Box::new(|x| (x as u8)): Box<Fn(i32) -> _>; //~ ERROR mismatched types
| ^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure
|
= note: expected type `std::boxed::Box<dyn std::ops::Fn(i32) -> _>`
found type `std::boxed::Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:36:22: 36:35]>`
error: aborting due to 14 previous errors
For more information about this error, try `rustc --explain E0308`.