Rollup merge of #69452 - Centril:typeck-pat, r=estebank

typeck: use `Pattern` obligation cause more for better diagnostics

r? @estebank
This commit is contained in:
Mazdak Farrokhzad 2020-02-28 17:17:28 +01:00 committed by GitHub
commit a245221497
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 284 additions and 102 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`
|
@ -10,6 +12,8 @@ LL | A::B => (),
error[E0308]: mismatched types
--> $DIR/issue-5100.rs:17:9
|
LL | match (true, false) {
| ------------- this expression has type `(bool, bool)`
LL | (true, false, false) => ()
| ^^^^^^^^^^^^^^^^^^^^ expected a tuple with 2 elements, found one with 3 elements
|
@ -19,6 +23,8 @@ LL | (true, false, false) => ()
error[E0308]: mismatched types
--> $DIR/issue-5100.rs:25:9
|
LL | match (true, false) {
| ------------- this expression has type `(bool, bool)`
LL | (true, false, false) => ()
| ^^^^^^^^^^^^^^^^^^^^ expected a tuple with 2 elements, found one with 3 elements
|
@ -39,6 +45,8 @@ LL | box (true, false) => ()
error[E0308]: mismatched types
--> $DIR/issue-5100.rs:40:9
|
LL | match (true, false) {
| ------------- this expression has type `(bool, bool)`
LL | &(true, false) => ()
| ^^^^^^^^^^^^^^ expected tuple, found reference
|

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`
|