fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
6.0 KiB248 linesraw
1error: expected expression, found `+`
2  --> $DIR/expr-as-stmt.rs:8:9
3   |
4LL |     {2} + {2}
5   |         ^ expected expression
6   |
7help: parentheses are required to parse this as an expression
8   |
9LL |     ({2}) + {2}
10   |     +   +
11
12error: leading `+` is not supported
13  --> $DIR/expr-as-stmt.rs:13:9
14   |
15LL |     {2} + 2
16   |         ^ unexpected `+`
17   |
18help: parentheses are required to parse this as an expression
19   |
20LL |     ({2}) + 2
21   |     +   +
22
23error: expected expression, found `+`
24  --> $DIR/expr-as-stmt.rs:19:12
25   |
26LL |     { 42 } + foo;
27   |            ^ expected expression
28   |
29help: parentheses are required to parse this as an expression
30   |
31LL |     ({ 42 }) + foo;
32   |     +      +
33
34error: expected expression, found `>`
35  --> $DIR/expr-as-stmt.rs:32:7
36   |
37LL |     } > 0
38   |       ^ expected expression
39   |
40help: parentheses are required to parse this as an expression
41   |
42LL ~     (match x {
43LL |         _ => 1,
44LL ~     }) > 0
45   |
46
47error: expected parameter name, found `{`
48  --> $DIR/expr-as-stmt.rs:41:16
49   |
50LL |     { true } | { true }
51   |                ^ expected parameter name
52   |
53help: parentheses are required to parse this as an expression
54   |
55LL |     ({ true }) | { true }
56   |     +        +
57
58error: expected expression, found `+`
59  --> $DIR/expr-as-stmt.rs:69:26
60   |
61LL |     match () { () => 1 } + match () { () => 1 }
62   |                          ^ expected expression
63   |
64help: parentheses are required to parse this as an expression
65   |
66LL |     (match () { () => 1 }) + match () { () => 1 }
67   |     +                    +
68
69error: expected expression, found `+`
70  --> $DIR/expr-as-stmt.rs:75:18
71   |
72LL |     unsafe { 1 } + unsafe { 1 }
73   |                  ^ expected expression
74   |
75help: parentheses are required to parse this as an expression
76   |
77LL |     (unsafe { 1 }) + unsafe { 1 }
78   |     +            +
79
80error[E0308]: mismatched types
81  --> $DIR/expr-as-stmt.rs:64:7
82   |
83LL |     { foo() } || { true }
84   |       ^^^^^- help: consider using a semicolon here: `;`
85   |       |
86   |       expected `()`, found `i32`
87
88error[E0308]: mismatched types
89  --> $DIR/expr-as-stmt.rs:8:6
90   |
91LL |     {2} + {2}
92   |      ^ expected `()`, found integer
93   |
94help: you might have meant to return this value
95   |
96LL |     {return 2;} + {2}
97   |      ++++++  +
98
99error[E0308]: mismatched types
100  --> $DIR/expr-as-stmt.rs:13:6
101   |
102LL |     {2} + 2
103   |      ^ expected `()`, found integer
104   |
105help: you might have meant to return this value
106   |
107LL |     {return 2;} + 2
108   |      ++++++  +
109
110error[E0308]: mismatched types
111  --> $DIR/expr-as-stmt.rs:19:7
112   |
113LL |     { 42 } + foo;
114   |       ^^ expected `()`, found integer
115   |
116help: you might have meant to return this value
117   |
118LL |     { return 42; } + foo;
119   |       ++++++   +
120
121error[E0308]: mismatched types
122  --> $DIR/expr-as-stmt.rs:25:7
123   |
124LL |     { 3 } * 3
125   |       ^ expected `()`, found integer
126   |
127help: you might have meant to return this value
128   |
129LL |     { return 3; } * 3
130   |       ++++++  +
131
132error[E0614]: type `{integer}` cannot be dereferenced
133  --> $DIR/expr-as-stmt.rs:25:11
134   |
135LL |     { 3 } * 3
136   |           ^^^
137   |
138help: parentheses are required to parse this as an expression
139   |
140LL |     ({ 3 }) * 3
141   |     +     +
142
143error[E0308]: mismatched types
144  --> $DIR/expr-as-stmt.rs:36:6
145   |
146LL |     {2} - 2
147   |      ^ expected `()`, found integer
148   |
149help: you might have meant to return this value
150   |
151LL |     {return 2;} - 2
152   |      ++++++  +
153
154error[E0600]: cannot apply unary operator `-` to type `u32`
155  --> $DIR/expr-as-stmt.rs:36:9
156   |
157LL |     {2} - 2
158   |         ^^^ cannot apply unary operator `-`
159   |
160help: parentheses are required to parse this as an expression
161   |
162LL |     ({2}) - 2
163   |     +   +
164
165error[E0308]: mismatched types
166  --> $DIR/expr-as-stmt.rs:41:7
167   |
168LL |     { true } | { true }
169   |       ^^^^ expected `()`, found `bool`
170   |
171help: you might have meant to return this value
172   |
173LL |     { return true; } | { true }
174   |       ++++++     +
175
176error[E0308]: mismatched types
177  --> $DIR/expr-as-stmt.rs:46:7
178   |
179LL |     { true } && { true }
180   |       ^^^^ expected `()`, found `bool`
181   |
182help: you might have meant to return this value
183   |
184LL |     { return true; } && { true }
185   |       ++++++     +
186
187error[E0308]: mismatched types
188  --> $DIR/expr-as-stmt.rs:46:14
189   |
190LL | fn revenge_from_mars() -> bool {
191   |                           ---- expected `bool` because of return type
192LL |     { true } && { true }
193   |              ^^^^^^^^^^^ expected `bool`, found `&&bool`
194   |
195help: parentheses are required to parse this as an expression
196   |
197LL |     ({ true }) && { true }
198   |     +        +
199
200error[E0308]: mismatched types
201  --> $DIR/expr-as-stmt.rs:51:7
202   |
203LL |     { true } || { true }
204   |       ^^^^ expected `()`, found `bool`
205   |
206help: you might have meant to return this value
207   |
208LL |     { return true; } || { true }
209   |       ++++++     +
210
211error[E0308]: mismatched types
212  --> $DIR/expr-as-stmt.rs:51:14
213   |
214LL | fn attack_from_mars() -> bool {
215   |                          ---- expected `bool` because of return type
216LL |     { true } || { true }
217   |              ^^^^^^^^^^^ expected `bool`, found closure
218   |
219   = note: expected type `bool`
220           found closure `{closure@$DIR/expr-as-stmt.rs:51:14: 51:16}`
221help: parentheses are required to parse this as an expression
222   |
223LL |     ({ true }) || { true }
224   |     +        +
225
226error[E0308]: mismatched types
227  --> $DIR/expr-as-stmt.rs:69:5
228   |
229LL |     match () { () => 1 } + match () { () => 1 }
230   |     ^^^^^^^^^^^^^^^^^^^^- help: consider using a semicolon here
231   |     |
232   |     expected `()`, found integer
233
234error[E0308]: mismatched types
235  --> $DIR/expr-as-stmt.rs:75:14
236   |
237LL |     unsafe { 1 } + unsafe { 1 }
238   |              ^ expected `()`, found integer
239   |
240help: you might have meant to return this value
241   |
242LL |     unsafe { return 1; } + unsafe { 1 }
243   |              ++++++  +
244
245error: aborting due to 22 previous errors
246
247Some errors have detailed explanations: E0308, E0600, E0614.
248For more information about an error, try `rustc --explain E0308`.