Skip to content

Tweak output of type mismatch between "then" and elseif arms - #57381

Merged
bors merged 2 commits into
rust-lang:masterfrom
estebank:if-else-308
Jan 14, 2019
Merged

Tweak output of type mismatch between "then" and elseif arms#57381
bors merged 2 commits into
rust-lang:masterfrom
estebank:if-else-308

Conversation

@estebank

@estebankestebank commented Jan 6, 2019

Copy link
Copy Markdown
Contributor
error[E0308]: if and else have incompatible types
--> $DIR/if-else-type-mismatch.rs:5:9
|
LL | let _ = if true {
| _____________-
LL | | 42i32
| | ----- expected because of this
LL | | } else {
LL | | 42u32
| | ^^^^^ expected i32, found u32
LL | | };
| |_____- if and else have incompatible types
|
= note: expected type `i32`
found type `u32`
error[E0308]: if and else have incompatible types
--> file.rs:2:38
|
LL | let _ = if false { 3u8; } else { 3u8 };
| ---- ^^^ expected (), found u8
| | |
| | help: consider removing this semicolon
| expected because of this
|
= note: expected type `()`
found type `u8`
error[E0308]: if and else have incompatible types
--> file.rs:3:37
|
LL | let _ = if false { 3u8 } else { 3u8; };
| --- ^^^-
| | | |
| | | help: consider removing this semicolon
| | expected u8, found ()
| expected because of this
|
= note: expected type `u8`
found type `()`
error[E0308]: if and else have incompatible types
--> file.rs:4:37
|
LL | let _ = if false { 3i8 } else { 3u8 };
| --- ^^^ expected i8, found u8
| |
| expected because of this
|
= note: expected type `i8`
found type `u8`

Fix#57348.

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @nikomatsakis

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

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 6, 2019
@nikomatsakis

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Jan 7, 2019

Copy link
Copy Markdown
Collaborator

📌 Commit 81f2cf0091fc3bc87db2093edc9b5bfca6797008 has been approved by nikomatsakis

@borsbors 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 7, 2019
@bors

bors commented Jan 10, 2019

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 81f2cf0091fc3bc87db2093edc9b5bfca6797008 with merge b366f65687a2ede5d206408861828dc32afbd17c...

@bors

bors commented Jan 10, 2019

Copy link
Copy Markdown
Collaborator

💔 Test failed - status-appveyor

@borsbors 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?

@borsbors 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

Copy link
Copy Markdown
ContributorAuthor

rebased to get bors unstuck

@bors r=nikomatsakis

@bors

bors commented Jan 13, 2019

Copy link
Copy Markdown
Collaborator

📌 Commit 54fe1c023a178d6f27c88de90cfdeda926584d19 has been approved by nikomatsakis

@CentrilCentril mentioned this pull request Jan 13, 2019
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 commented Jan 14, 2019

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #57580) made this pull request unmergeable. Please resolve the merge conflicts.

@borsbors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jan 14, 2019
@estebank

Copy link
Copy Markdown
ContributorAuthor

Fixed merge conflict

@bors r=nikomatsakis

@bors

bors commented Jan 14, 2019

Copy link
Copy Markdown
Collaborator

📌 Commit 9567544 has been approved by nikomatsakis

@borsbors removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jan 14, 2019
@borsbors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jan 14, 2019
@bors

bors commented Jan 14, 2019

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 9567544 with merge 0bc0015...

bors added a commit that referenced this pull request Jan 14, 2019
Tweak output of type mismatch between "then" and `else` `if` arms
```
error[E0308]: if and else have incompatible types
--> $DIR/if-else-type-mismatch.rs:5:9
|
LL | let _ = if true {
| _____________-
LL | | 42i32
| | ----- expected because of this
LL | | } else {
LL | | 42u32
| | ^^^^^ expected i32, found u32
LL | | };
| |_____- if and else have incompatible types
|
= note: expected type `i32`
found type `u32`
error[E0308]: if and else have incompatible types
--> file.rs:2:38
|
LL | let _ = if false { 3u8; } else { 3u8 };
| ---- ^^^ expected (), found u8
| | |
| | help: consider removing this semicolon
| expected because of this
|
= note: expected type `()`
found type `u8`
error[E0308]: if and else have incompatible types
--> file.rs:3:37
|
LL | let _ = if false { 3u8 } else { 3u8; };
| --- ^^^-
| | | |
| | | help: consider removing this semicolon
| | expected u8, found ()
| expected because of this
|
= note: expected type `u8`
found type `()`
error[E0308]: if and else have incompatible types
--> file.rs:4:37
|
LL | let _ = if false { 3i8 } else { 3u8 };
| --- ^^^ expected i8, found u8
| |
| expected because of this
|
= note: expected type `i8`
found type `u8`
```
Fix#57348.
@bors

bors commented Jan 14, 2019

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-travis, status-appveyor
Approved by: nikomatsakis
Pushing 0bc0015 to master...

@bors
bors merged commit 9567544 into rust-lang:masterJan 14, 2019
@borsbors mentioned this pull request Jan 14, 2019
37 tasks
@estebank
estebank deleted the if-else-308 branch November 9, 2023 05:20
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: 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.

5 participants

@estebank@rust-highfive@nikomatsakis@bors@emilyalbini