Skip to content

Point at match discriminant on type error in match arm pattern#57366

Merged
bors merged 5 commits intorust-lang:masterfrom
estebank:point-match-discrim
Jan 14, 2019
Merged

Point at match discriminant on type error in match arm pattern#57366
bors merged 5 commits intorust-lang:masterfrom
estebank:point-match-discrim

Conversation

@estebank
Copy link
Copy Markdown
Contributor

@estebank estebank commented Jan 6, 2019

error[E0308]: mismatched types
 --> src/main.rs:5:9
  |
4 |    let temp: usize = match a + b {
  |                            ----- this expression has type `usize`
5 |         Ok(num) => num,
  |         ^^^^^^^ expected usize, found enum `std::result::Result`
  |
  = note: expected type `usize`
             found type `std::result::Result<_, _>`

Fix #57279.

@rust-highfive
Copy link
Copy Markdown
Contributor

r? @michaelwoerister

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 6, 2019
Comment thread src/test/ui/mismatched_types/E0409.stderr Outdated
Comment thread src/test/ui/match/match-range-fail.stderr Outdated
@estebank estebank changed the title Point at the match discriminant when arm pattern has a type mismatch Point at match discrimant on type error in match arm pattern Jan 6, 2019
@estebank estebank changed the title Point at match discrimant on type error in match arm pattern Point at match discriminant on type error in match arm pattern Jan 6, 2019
Comment thread src/librustc/infer/error_reporting/mod.rs Outdated
@rust-highfive

This comment has been minimized.

@michaelwoerister
Copy link
Copy Markdown
Member

@varkor, would you be up for giving this a full review? Since my review backlog has grown a second page over the break, I'm glad about anything that I can hand off :)

@varkor
Copy link
Copy Markdown
Contributor

varkor commented Jan 7, 2019

r? @varkor

I'll take a proper look soon.

@michaelwoerister
Copy link
Copy Markdown
Member

Thanks a lot, @varkor!

Copy link
Copy Markdown
Contributor

@varkor varkor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! r=me with the updated comment.

Comment thread src/librustc_typeck/check/_match.rs Outdated
@estebank
Copy link
Copy Markdown
Contributor Author

estebank commented Jan 9, 2019

@bors r=varkor

@bors
Copy link
Copy Markdown
Collaborator

bors commented Jan 9, 2019

📌 Commit e70390a19e624ee6ff76d427f07d7dc4b040e843 has been approved by varkor

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 9, 2019
@bors
Copy link
Copy Markdown
Collaborator

bors commented Jan 10, 2019

⌛ Testing commit e70390a19e624ee6ff76d427f07d7dc4b040e843 with merge 90db9244e783284768325521220fb2a0cbd6ef05...

@bors
Copy link
Copy Markdown
Collaborator

bors commented Jan 10, 2019

💔 Test failed - status-appveyor

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jan 10, 2019
@emilyalbini
Copy link
Copy Markdown
Member

@bors retry
AppVeyor... what's wrong with you today?

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 10, 2019
@estebank estebank force-pushed the point-match-discrim branch from e70390a to 10fbdbf Compare January 13, 2019 03:36
@estebank
Copy link
Copy Markdown
Contributor Author

rebased to get bors unstuck

@bors r=varkor

@bors
Copy link
Copy Markdown
Collaborator

bors commented Jan 13, 2019

📌 Commit 10fbdbf has been approved by varkor

Centril added a commit to Centril/rust that referenced this pull request Jan 13, 2019
Point at match discriminant on type error in match arm pattern

```
error[E0308]: mismatched types
 --> src/main.rs:5:9
  |
4 |    let temp: usize = match a + b {
  |                            ----- this expression has type `usize`
5 |         Ok(num) => num,
  |         ^^^^^^^ expected usize, found enum `std::result::Result`
  |
  = note: expected type `usize`
             found type `std::result::Result<_, _>`
```
Fix rust-lang#57279.
bors added a commit that referenced this pull request Jan 13, 2019
Rollup of 4 pull requests

Successful merges:

 - #56874 (Simplify foreign type rendering.)
 - #57113 (Move diagnostics out from QueryJob and optimize for the case with no diagnostics)
 - #57366 (Point at match discriminant on type error in match arm pattern)
 - #57538 (librustc_mir: Fix ICE with slice patterns)

Failed merges:

 - #57381 (Tweak output of type mismatch between "then" and `else` `if` arms)

r? @ghost
@bors bors merged commit 10fbdbf into rust-lang:master Jan 14, 2019
@estebank estebank deleted the point-match-discrim branch November 9, 2023 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants