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