mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 11:44:28 +00:00
130 lines
3.3 KiB
Plaintext
130 lines
3.3 KiB
Plaintext
error[E0308]: mismatched types
|
|
--> $DIR/stmts-as-exp-105431.rs:11:5
|
|
|
|
|
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
|
|
--> $DIR/stmts-as-exp-105431.rs:15:13
|
|
|
|
|
LL | if true {
|
|
| _____________^
|
|
LL | | eprintln!("hello");
|
|
LL | | 3;
|
|
| | - help: remove this semicolon to return this value
|
|
LL | | }
|
|
| |_____^ expected `i32`, found `()`
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/stmts-as-exp-105431.rs:19:10
|
|
|
|
|
LL | else {
|
|
| __________^
|
|
LL | | 4;
|
|
| | - help: remove this semicolon to return this value
|
|
LL | | }
|
|
| |_____^ expected `i32`, found `()`
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/stmts-as-exp-105431.rs:30:5
|
|
|
|
|
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
|
|
--> $DIR/stmts-as-exp-105431.rs:36:14
|
|
|
|
|
LL | 1 => { 1; }
|
|
| ^^^-^^
|
|
| | |
|
|
| | help: remove this semicolon to return this value
|
|
| expected `i32`, found `()`
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/stmts-as-exp-105431.rs:37:14
|
|
|
|
|
LL | _ => { 2; }
|
|
| ^^^-^^
|
|
| | |
|
|
| | help: remove this semicolon to return this value
|
|
| expected `i32`, found `()`
|
|
|
|
error[E0308]: `match` arms have incompatible types
|
|
--> $DIR/stmts-as-exp-105431.rs:45:16
|
|
|
|
|
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
|
|
--> $DIR/stmts-as-exp-105431.rs:59:5
|
|
|
|
|
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
|
|
--> $DIR/stmts-as-exp-105431.rs:72:5
|
|
|
|
|
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`.
|