]> git.lizzy.rs Git - rust.git/blob - src/test/ui/if/if-without-else-as-fn-expr.stderr
Auto merge of #49799 - hdhoang:46205_deny_incoherent_fundamental_impls, r=nikomatsakis
[rust.git] / src / test / ui / if / if-without-else-as-fn-expr.stderr
1 error[E0308]: mismatched types
2   --> $DIR/if-without-else-as-fn-expr.rs:2:5
3    |
4 LL | /     if bar % 5 == 0 {
5 LL | |         return 3;
6 LL | |     }
7    | |_____^ expected usize, found ()
8    |
9    = note: expected type `usize`
10               found type `()`
11
12 error[E0317]: if may be missing an else clause
13   --> $DIR/if-without-else-as-fn-expr.rs:2:5
14    |
15 LL |   fn foo(bar: usize) -> usize {
16    |                         ----- expected `usize` because of this return type
17 LL | /     if bar % 5 == 0 {
18 LL | |         return 3;
19 LL | |     }
20    | |_____^ expected usize, found ()
21    |
22    = note: expected type `usize`
23               found type `()`
24    = note: `if` expressions without `else` evaluate to `()`
25    = help: consider adding an `else` block that evaluates to the expected type
26
27 error[E0308]: mismatched types
28   --> $DIR/if-without-else-as-fn-expr.rs:10:20
29    |
30 LL |       let x: usize = if bar % 5 == 0 {
31    |  ____________________^
32 LL | |         return 3;
33 LL | |     };
34    | |_____^ expected usize, found ()
35    |
36    = note: expected type `usize`
37               found type `()`
38
39 error[E0317]: if may be missing an else clause
40   --> $DIR/if-without-else-as-fn-expr.rs:10:20
41    |
42 LL |       let x: usize = if bar % 5 == 0 {
43    |  _________-__________^
44    | |         |
45    | |         expected because of this assignment
46 LL | |         return 3;
47 LL | |     };
48    | |_____^ expected usize, found ()
49    |
50    = note: expected type `usize`
51               found type `()`
52    = note: `if` expressions without `else` evaluate to `()`
53    = help: consider adding an `else` block that evaluates to the expected type
54
55 error[E0308]: mismatched types
56   --> $DIR/if-without-else-as-fn-expr.rs:19:5
57    |
58 LL | /     if bar % 5 == 0 {
59 LL | |         3
60 LL | |     }
61    | |_____^ expected usize, found ()
62    |
63    = note: expected type `usize`
64               found type `()`
65
66 error[E0317]: if may be missing an else clause
67   --> $DIR/if-without-else-as-fn-expr.rs:19:5
68    |
69 LL |   fn foo3(bar: usize) -> usize {
70    |                          ----- expected `usize` because of this return type
71 LL | /     if bar % 5 == 0 {
72 LL | |         3
73 LL | |     }
74    | |_____^ expected usize, found ()
75    |
76    = note: expected type `usize`
77               found type `()`
78    = note: `if` expressions without `else` evaluate to `()`
79    = help: consider adding an `else` block that evaluates to the expected type
80
81 error[E0308]: mismatched types
82   --> $DIR/if-without-else-as-fn-expr.rs:27:5
83    |
84 LL | /     if let 0 = 1 {
85 LL | |         return 3;
86 LL | |     }
87    | |_____^ expected usize, found ()
88    |
89    = note: expected type `usize`
90               found type `()`
91
92 error[E0317]: if may be missing an else clause
93   --> $DIR/if-without-else-as-fn-expr.rs:27:5
94    |
95 LL |   fn foo_let(bar: usize) -> usize {
96    |                             ----- expected `usize` because of this return type
97 LL | /     if let 0 = 1 {
98 LL | |         return 3;
99 LL | |     }
100    | |_____^ expected usize, found ()
101    |
102    = note: expected type `usize`
103               found type `()`
104    = note: `if` expressions without `else` evaluate to `()`
105    = help: consider adding an `else` block that evaluates to the expected type
106
107 error[E0308]: mismatched types
108   --> $DIR/if-without-else-as-fn-expr.rs:35:20
109    |
110 LL |       let x: usize = if let 0 = 1 {
111    |  ____________________^
112 LL | |         return 3;
113 LL | |     };
114    | |_____^ expected usize, found ()
115    |
116    = note: expected type `usize`
117               found type `()`
118
119 error[E0317]: if may be missing an else clause
120   --> $DIR/if-without-else-as-fn-expr.rs:35:20
121    |
122 LL |       let x: usize = if let 0 = 1 {
123    |  _________-__________^
124    | |         |
125    | |         expected because of this assignment
126 LL | |         return 3;
127 LL | |     };
128    | |_____^ expected usize, found ()
129    |
130    = note: expected type `usize`
131               found type `()`
132    = note: `if` expressions without `else` evaluate to `()`
133    = help: consider adding an `else` block that evaluates to the expected type
134
135 error[E0308]: mismatched types
136   --> $DIR/if-without-else-as-fn-expr.rs:44:5
137    |
138 LL | /     if let 0 = 1 {
139 LL | |         3
140 LL | |     }
141    | |_____^ expected usize, found ()
142    |
143    = note: expected type `usize`
144               found type `()`
145
146 error[E0317]: if may be missing an else clause
147   --> $DIR/if-without-else-as-fn-expr.rs:44:5
148    |
149 LL |   fn foo3_let(bar: usize) -> usize {
150    |                              ----- expected `usize` because of this return type
151 LL | /     if let 0 = 1 {
152 LL | |         3
153 LL | |     }
154    | |_____^ expected usize, found ()
155    |
156    = note: expected type `usize`
157               found type `()`
158    = note: `if` expressions without `else` evaluate to `()`
159    = help: consider adding an `else` block that evaluates to the expected type
160
161 error: aborting due to 12 previous errors
162
163 Some errors have detailed explanations: E0308, E0317.
164 For more information about an error, try `rustc --explain E0308`.