]> git.proxmox.com Git - rustc.git/blame - src/test/ui/if/if-without-else-as-fn-expr.stderr
New upstream version 1.42.0+dfsg1
[rustc.git] / src / test / ui / if / if-without-else-as-fn-expr.stderr
CommitLineData
dfeec247 1error[E0317]: `if` may be missing an `else` clause
532ac7d7
XL
2 --> $DIR/if-without-else-as-fn-expr.rs:2:5
3 |
4LL | fn foo(bar: usize) -> usize {
5 | ----- expected `usize` because of this return type
6LL | / if bar % 5 == 0 {
7LL | | return 3;
8LL | | }
60c5eb7d 9 | |_____^ expected `usize`, found `()`
532ac7d7 10 |
532ac7d7
XL
11 = note: `if` expressions without `else` evaluate to `()`
12 = help: consider adding an `else` block that evaluates to the expected type
13
dfeec247 14error[E0317]: `if` may be missing an `else` clause
e1599b0c 15 --> $DIR/if-without-else-as-fn-expr.rs:9:20
532ac7d7
XL
16 |
17LL | let x: usize = if bar % 5 == 0 {
18 | _________-__________^
19 | | |
20 | | expected because of this assignment
21LL | | return 3;
22LL | | };
60c5eb7d 23 | |_____^ expected `usize`, found `()`
532ac7d7 24 |
532ac7d7
XL
25 = note: `if` expressions without `else` evaluate to `()`
26 = help: consider adding an `else` block that evaluates to the expected type
27
dfeec247 28error[E0317]: `if` may be missing an `else` clause
e1599b0c 29 --> $DIR/if-without-else-as-fn-expr.rs:17:5
532ac7d7
XL
30 |
31LL | fn foo3(bar: usize) -> usize {
32 | ----- expected `usize` because of this return type
33LL | / if bar % 5 == 0 {
34LL | | 3
35LL | | }
60c5eb7d 36 | |_____^ expected `usize`, found `()`
532ac7d7 37 |
532ac7d7
XL
38 = note: `if` expressions without `else` evaluate to `()`
39 = help: consider adding an `else` block that evaluates to the expected type
40
dfeec247 41error[E0317]: `if` may be missing an `else` clause
e1599b0c 42 --> $DIR/if-without-else-as-fn-expr.rs:24:5
48663c56
XL
43 |
44LL | fn foo_let(bar: usize) -> usize {
45 | ----- expected `usize` because of this return type
46LL | / if let 0 = 1 {
47LL | | return 3;
48LL | | }
60c5eb7d 49 | |_____^ expected `usize`, found `()`
48663c56 50 |
48663c56
XL
51 = note: `if` expressions without `else` evaluate to `()`
52 = help: consider adding an `else` block that evaluates to the expected type
53
dfeec247 54error[E0317]: `if` may be missing an `else` clause
e1599b0c 55 --> $DIR/if-without-else-as-fn-expr.rs:31:20
48663c56
XL
56 |
57LL | let x: usize = if let 0 = 1 {
58 | _________-__________^
59 | | |
60 | | expected because of this assignment
61LL | | return 3;
62LL | | };
60c5eb7d 63 | |_____^ expected `usize`, found `()`
48663c56 64 |
48663c56
XL
65 = note: `if` expressions without `else` evaluate to `()`
66 = help: consider adding an `else` block that evaluates to the expected type
67
dfeec247 68error[E0317]: `if` may be missing an `else` clause
e1599b0c 69 --> $DIR/if-without-else-as-fn-expr.rs:39:5
48663c56
XL
70 |
71LL | fn foo3_let(bar: usize) -> usize {
72 | ----- expected `usize` because of this return type
73LL | / if let 0 = 1 {
74LL | | 3
75LL | | }
60c5eb7d 76 | |_____^ expected `usize`, found `()`
48663c56 77 |
48663c56
XL
78 = note: `if` expressions without `else` evaluate to `()`
79 = help: consider adding an `else` block that evaluates to the expected type
80
e1599b0c 81error: aborting due to 6 previous errors
532ac7d7 82
e1599b0c 83For more information about this error, try `rustc --explain E0317`.