2024-02-15 10:25:56 -06:00
|
|
|
error[E0308]: mismatched types
|
2024-02-20 19:37:45 -06:00
|
|
|
--> $DIR/stmts-as-exp-105431.rs:11:5
|
2024-02-15 10:25:56 -06:00
|
|
|
|
|
|
|
|
LL | fn test_if() -> i32 {
|
|
|
|
| --- expected `i32` because of return type
|
|
|
|
...
|
|
|
|
LL | x
|
|
|
|
| ^ expected `i32`, found `()`
|
|
|
|
|
|
|
|
|
help: remove this semicolon to return this value
|
|
|
|
|
|
|
|
|
LL - 3;
|
|
|
|
LL + 3
|
|
|
|
|
|
|
|
|
help: remove this semicolon to return this value
|
|
|
|
|
|
|
|
|
LL - 4;
|
|
|
|
LL + 4
|
|
|
|
|
|
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2024-02-20 19:37:45 -06:00
|
|
|
--> $DIR/stmts-as-exp-105431.rs:15:13
|
2024-02-15 10:25:56 -06:00
|
|
|
|
|
|
|
|
LL | if true {
|
|
|
|
| _____________^
|
|
|
|
LL | | eprintln!("hello");
|
|
|
|
LL | | 3;
|
|
|
|
| | - help: remove this semicolon to return this value
|
|
|
|
LL | | }
|
|
|
|
| |_____^ expected `i32`, found `()`
|
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2024-02-20 19:37:45 -06:00
|
|
|
--> $DIR/stmts-as-exp-105431.rs:19:10
|
2024-02-15 10:25:56 -06:00
|
|
|
|
|
|
|
|
LL | else {
|
|
|
|
| __________^
|
|
|
|
LL | | 4;
|
|
|
|
| | - help: remove this semicolon to return this value
|
|
|
|
LL | | }
|
|
|
|
| |_____^ expected `i32`, found `()`
|
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2024-02-20 19:37:45 -06:00
|
|
|
--> $DIR/stmts-as-exp-105431.rs:30:5
|
2024-02-15 10:25:56 -06:00
|
|
|
|
|
|
|
|
LL | fn test_match() -> i32 {
|
|
|
|
| --- expected `i32` because of return type
|
|
|
|
...
|
|
|
|
LL | res
|
|
|
|
| ^^^ expected `i32`, found `()`
|
|
|
|
|
|
|
|
|
help: remove this semicolon to return this value
|
|
|
|
|
|
|
|
|
LL - 1 => { 1; }
|
|
|
|
LL + 1 => { 1 }
|
|
|
|
|
|
|
|
|
help: remove this semicolon to return this value
|
|
|
|
|
|
|
|
|
LL - _ => { 2; }
|
|
|
|
LL + _ => { 2 }
|
|
|
|
|
|
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2024-02-20 19:37:45 -06:00
|
|
|
--> $DIR/stmts-as-exp-105431.rs:36:14
|
2024-02-15 10:25:56 -06:00
|
|
|
|
|
|
|
|
LL | 1 => { 1; }
|
|
|
|
| ^^^-^^
|
|
|
|
| | |
|
|
|
|
| | help: remove this semicolon to return this value
|
|
|
|
| expected `i32`, found `()`
|
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2024-02-20 19:37:45 -06:00
|
|
|
--> $DIR/stmts-as-exp-105431.rs:37:14
|
2024-02-15 10:25:56 -06:00
|
|
|
|
|
|
|
|
LL | _ => { 2; }
|
|
|
|
| ^^^-^^
|
|
|
|
| | |
|
|
|
|
| | help: remove this semicolon to return this value
|
|
|
|
| expected `i32`, found `()`
|
|
|
|
|
|
|
|
error[E0308]: `match` arms have incompatible types
|
2024-02-20 19:37:45 -06:00
|
|
|
--> $DIR/stmts-as-exp-105431.rs:45:16
|
2024-02-15 10:25:56 -06:00
|
|
|
|
|
|
|
|
LL | let res = match v {
|
|
|
|
| _______________-
|
|
|
|
LL | | 1 => { if 1 < 2 { 1 } else { 2 } }
|
|
|
|
| | ------------------------- this is found to be of type `{integer}`
|
|
|
|
LL | | _ => { 2; }
|
|
|
|
| | ^-
|
|
|
|
| | ||
|
|
|
|
| | |help: consider removing this semicolon
|
|
|
|
| | expected integer, found `()`
|
|
|
|
LL | | };
|
|
|
|
| |_____- `match` arms have incompatible types
|
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2024-02-20 19:37:45 -06:00
|
|
|
--> $DIR/stmts-as-exp-105431.rs:59:5
|
2024-02-15 10:25:56 -06:00
|
|
|
|
|
|
|
|
LL | fn test_if_match_mixed() -> i32 {
|
|
|
|
| --- expected `i32` because of return type
|
|
|
|
...
|
|
|
|
LL | x
|
|
|
|
| ^ expected `i32`, found `()`
|
|
|
|
|
|
|
|
|
help: remove this semicolon to return this value
|
|
|
|
|
|
|
|
|
LL - 3;
|
|
|
|
LL + 3
|
|
|
|
|
|
|
|
|
help: remove this semicolon to return this value
|
|
|
|
|
|
|
|
|
LL - };
|
|
|
|
LL + }
|
|
|
|
|
|
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2024-02-20 19:37:45 -06:00
|
|
|
--> $DIR/stmts-as-exp-105431.rs:72:5
|
2024-02-15 10:25:56 -06:00
|
|
|
|
|
|
|
|
LL | fn test_if_match_mixed_failed() -> i32 {
|
|
|
|
| --- expected `i32` because of return type
|
|
|
|
LL | let x = if true {
|
|
|
|
LL | 3;
|
|
|
|
| - help: remove this semicolon to return this value
|
|
|
|
...
|
|
|
|
LL | x
|
|
|
|
| ^ expected `i32`, found `()`
|
|
|
|
|
|
|
|
error: aborting due to 9 previous errors
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0308`.
|