error[E0308]: `if` and `else` have incompatible types --> $DIR/if-else-type-mismatch.rs:5:9 | LL | let _ = if true { | _____________- LL | | 1i32 | | ---- expected because of this LL | | } else { LL | | 2u32 | | ^^^^ expected `i32`, found `u32` LL | | }; | |_____- `if` and `else` have incompatible types | help: change the type of the numeric literal from `u32` to `i32` | LL | 2i32 | ~~~ error[E0308]: `if` and `else` have incompatible types --> $DIR/if-else-type-mismatch.rs:8:38 | LL | let _ = if true { 42i32 } else { 42u32 }; | ----- ^^^^^ expected `i32`, found `u32` | | | expected because of this | help: change the type of the numeric literal from `u32` to `i32` | LL | let _ = if true { 42i32 } else { 42i32 }; | ~~~ error[E0308]: `if` and `else` have incompatible types --> $DIR/if-else-type-mismatch.rs:13:9 | LL | let _ = if true { | _____________- LL | | 3u32; | | ----- | | | | | | | help: consider removing this semicolon | | expected because of this LL | | } else { LL | | 4u32 | | ^^^^ expected `()`, found `u32` LL | | }; | |_____- `if` and `else` have incompatible types error[E0308]: `if` and `else` have incompatible types --> $DIR/if-else-type-mismatch.rs:19:9 | LL | let _ = if true { | _____________- LL | | 5u32 | | ---- expected because of this LL | | } else { LL | | 6u32; | | ^^^^- | | | | | | | help: consider removing this semicolon | | expected `u32`, found `()` LL | | }; | |_____- `if` and `else` have incompatible types error[E0308]: `if` and `else` have incompatible types --> $DIR/if-else-type-mismatch.rs:25:9 | LL | let _ = if true { | _____________- LL | | 7i32; | | ----- expected because of this LL | | } else { LL | | 8u32 | | ^^^^ expected `()`, found `u32` LL | | }; | |_____- `if` and `else` have incompatible types error[E0308]: `if` and `else` have incompatible types --> $DIR/if-else-type-mismatch.rs:31:9 | LL | let _ = if true { | _____________- LL | | 9i32 | | ---- expected because of this LL | | } else { LL | | 10u32; | | ^^^^^^ expected `i32`, found `()` LL | | }; | |_____- `if` and `else` have incompatible types error[E0308]: `if` and `else` have incompatible types --> $DIR/if-else-type-mismatch.rs:37:9 | LL | let _ = if true { | _____________________- LL | | LL | | } else { | |_____- expected because of this LL | 11u32 | ^^^^^ expected `()`, found `u32` error[E0308]: `if` and `else` have incompatible types --> $DIR/if-else-type-mismatch.rs:42:12 | LL | let _ = if true { | ------- `if` and `else` have incompatible types LL | 12i32 | ----- expected because of this LL | } else { | ____________^ LL | | LL | | }; | |_____^ expected `i32`, found `()` error: aborting due to 8 previous errors For more information about this error, try `rustc --explain E0308`.