enhance check_pat_lit with TopInfo

This commit is contained in:
Mazdak Farrokhzad 2020-02-25 04:10:58 +01:00
parent 9b6e0e8b94
commit 5da3a2f354
5 changed files with 27 additions and 6 deletions

View file

@ -1,6 +1,9 @@
error[E0308]: mismatched types
--> $DIR/match-ill-type2.rs:4:9
|
LL | match 1i32 {
| ---- this expression has type `i32`
LL | 1i32 => 1,
LL | 2u32 => 1,
| ^^^^ expected `i32`, found `u32`

View file

@ -1,6 +1,8 @@
error[E0308]: mismatched types
--> $DIR/lit.rs:7:13
|
LL | match &s {
| -- this expression has type `&&str`
LL | "abc" => true,
| ^^^^^ expected `&str`, found `str`
|
@ -10,6 +12,8 @@ LL | "abc" => true,
error[E0308]: mismatched types
--> $DIR/lit.rs:16:9
|
LL | match &s {
| -- this expression has type `&&[u8]`
LL | b"abc" => true,
| ^^^^^^ expected `&[u8]`, found array `[u8; 3]`
|

View file

@ -1,6 +1,8 @@
error[E0308]: mismatched types
--> $DIR/slightly-nice-generic-literal-messages.rs:7:9
|
LL | match Foo(1.1, marker::PhantomData) {
| ----------------------------- this expression has type `Foo<{float}, _>`
LL | 1 => {}
| ^ expected struct `Foo`, found integer
|