New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from Jan 14, 2019

Conversation

Projects
None yet
5 participants
@estebank
Copy link
Contributor

estebank commented Jan 6, 2019

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

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jan 6, 2019

r? @nikomatsakis

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

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Jan 7, 2019

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 7, 2019

📌 Commit 81f2cf0 has been approved by nikomatsakis

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 10, 2019

⌛️ Testing commit 81f2cf0 with merge b366f65...

bors added a commit that referenced this pull request Jan 10, 2019

Auto merge of #57381 - estebank:if-else-308, r=nikomatsakis
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

This comment has been minimized.

Copy link
Contributor

bors commented Jan 10, 2019

💔 Test failed - status-appveyor

@pietroalbini

This comment has been minimized.

Copy link
Member

pietroalbini commented Jan 10, 2019

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

@estebank estebank force-pushed the estebank:if-else-308 branch from 81f2cf0 to 54fe1c0 Jan 13, 2019

@estebank

This comment has been minimized.

Copy link
Contributor

estebank commented Jan 13, 2019

rebased to get bors unstuck

@bors r=nikomatsakis

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 13, 2019

📌 Commit 54fe1c0 has been approved by nikomatsakis

bors added a commit that referenced this pull request Jan 13, 2019

Auto merge of #57580 - Centril:rollup, r=Centril
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

This comment has been minimized.

Copy link
Contributor

bors commented Jan 14, 2019

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

@estebank estebank force-pushed the estebank:if-else-308 branch from 54fe1c0 to 9567544 Jan 14, 2019

@estebank

This comment has been minimized.

Copy link
Contributor

estebank commented Jan 14, 2019

Fixed merge conflict

@bors r=nikomatsakis

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 14, 2019

📌 Commit 9567544 has been approved by nikomatsakis

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 14, 2019

⌛️ Testing commit 9567544 with merge 0bc0015...

bors added a commit that referenced this pull request Jan 14, 2019

Auto merge of #57381 - estebank:if-else-308, r=nikomatsakis
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

This comment has been minimized.

Copy link
Contributor

bors commented Jan 14, 2019

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

@bors bors merged commit 9567544 into rust-lang:master Jan 14, 2019

1 check passed

homu Test successful
Details

@bors bors referenced this pull request Jan 14, 2019

Open

[WIP] HirId-ification #57578

31 of 37 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment