]> git.lizzy.rs Git - rust.git/blob - src/test/ui/parser/expr-as-stmt.rs
Rollup merge of #92024 - pcwalton:per-codegen-unit-names, r=davidtwco
[rust.git] / src / test / ui / parser / expr-as-stmt.rs
1 // run-rustfix
2 // rustfix-only-machine-applicable
3 #![allow(unused_variables)]
4 #![allow(dead_code)]
5 #![allow(unused_must_use)]
6
7 fn foo() -> i32 {
8     {2} + {2} //~ ERROR expected expression, found `+`
9     //~^ ERROR mismatched types
10 }
11
12 fn bar() -> i32 {
13     {2} + 2 //~ ERROR leading `+` is not supported
14     //~^ ERROR mismatched types
15 }
16
17 fn zul() -> u32 {
18     let foo = 3;
19     { 42 } + foo; //~ ERROR expected expression, found `+`
20     //~^ ERROR mismatched types
21     32
22 }
23
24 fn baz() -> i32 {
25     { 3 } * 3 //~ ERROR type `{integer}` cannot be dereferenced
26     //~^ ERROR mismatched types
27 }
28
29 fn moo(x: u32) -> bool {
30     match x {
31         _ => 1,
32     } > 0 //~ ERROR expected expression
33 }
34
35 fn qux() -> u32 {
36     {2} - 2 //~ ERROR cannot apply unary operator `-` to type `u32`
37     //~^ ERROR mismatched types
38 }
39
40 fn main() {}