check_pat_path: use pattern_cause

This commit is contained in:
Mazdak Farrokhzad 2020-02-25 05:41:03 +01:00
parent 1d33717583
commit e9f6bb7f79
9 changed files with 27 additions and 5 deletions

View file

@ -12,6 +12,9 @@ LL | Some(k) => match k {
error[E0308]: mismatched types
--> $DIR/issue-12552.rs:9:5
|
LL | match t {
| - this expression has type `std::result::Result<_, {integer}>`
...
LL | None => ()
| ^^^^ expected enum `std::result::Result`, found enum `std::option::Option`
|

View file

@ -2,7 +2,9 @@ error[E0308]: mismatched types
--> $DIR/issue-37026.rs:6:9
|
LL | let empty_struct::XEmpty2 = ();
| ^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `empty_struct::XEmpty2`
| ^^^^^^^^^^^^^^^^^^^^^ -- this expression has type `()`
| |
| expected `()`, found struct `empty_struct::XEmpty2`
error[E0308]: mismatched types
--> $DIR/issue-37026.rs:7:9

View file

@ -1,6 +1,8 @@
error[E0308]: mismatched types
--> $DIR/issue-5100.rs:8:9
|
LL | match (true, false) {
| ------------- this expression has type `(bool, bool)`
LL | A::B => (),
| ^^^^ expected tuple, found enum `A`
|

View file

@ -1,6 +1,8 @@
error[E0308]: mismatched types
--> $DIR/issue-7867.rs:7:9
|
LL | match (true, false) {
| ------------- this expression has type `(bool, bool)`
LL | A::B => (),
| ^^^^ expected tuple, found enum `A`
|

View file

@ -2,7 +2,9 @@ error[E0308]: mismatched types
--> $DIR/match-tag-nullary.rs:4:40
|
LL | fn main() { let x: A = A::A; match x { B::B => { } } }
| ^^^^ expected enum `A`, found enum `B`
| - ^^^^ expected enum `A`, found enum `B`
| |
| this expression has type `A`
error: aborting due to previous error

View file

@ -1,6 +1,8 @@
error[E0308]: mismatched types
--> $DIR/pattern-ident-path-generics.rs:3:9
|
LL | match Some("foo") {
| ----------- this expression has type `std::option::Option<&str>`
LL | None::<isize> => {}
| ^^^^^^^^^^^^^ expected `&str`, found `isize`
|

View file

@ -2,7 +2,9 @@ error[E0308]: mismatched types
--> $DIR/name-clash-nullary.rs:2:7
|
LL | let None: isize = 42;
| ^^^^ expected `isize`, found enum `std::option::Option`
| ^^^^ ----- expected due to this
| |
| expected `isize`, found enum `std::option::Option`
|
= note: expected type `isize`
found enum `std::option::Option<_>`

View file

@ -1,6 +1,8 @@
error[E0308]: mismatched types
--> $DIR/const.rs:14:9
|
LL | match &f {
| -- this expression has type `&Foo`
LL | FOO => {},
| ^^^ expected `&Foo`, found struct `Foo`