2 // rustfix-only-machine-applicable
3 #![allow(unused_variables)]
5 #![allow(unused_must_use)]
8 ({2}) + {2} //~ ERROR expected expression, found `+`
9 //~^ ERROR mismatched types
13 ({2}) + 2 //~ ERROR leading `+` is not supported
14 //~^ ERROR mismatched types
19 ({ 42 }) + foo; //~ ERROR expected expression, found `+`
20 //~^ ERROR mismatched types
25 ({ 3 }) * 3 //~ ERROR type `{integer}` cannot be dereferenced
26 //~^ ERROR mismatched types
29 fn moo(x: u32) -> bool {
32 }) > 0 //~ ERROR expected expression
36 ({2}) - 2 //~ ERROR cannot apply unary operator `-` to type `u32`
37 //~^ ERROR mismatched types
40 fn space_cadet() -> bool {
41 ({ true }) | { true } //~ ERROR E0308
42 //~^ ERROR expected parameter name
45 fn revenge_from_mars() -> bool {
46 ({ true }) && { true } //~ ERROR E0308
47 //~^ ERROR mismatched types
50 fn attack_from_mars() -> bool {
51 ({ true }) || { true } //~ ERROR E0308
52 //~^ ERROR mismatched types
55 // This gets corrected by adding a semicolon, instead of parens.
56 // It's placed here to help keep track of the way this diagnostic
57 // needs to interact with type checking to avoid MachineApplicable
58 // suggestions that actually break stuff.
60 // If you're wondering what happens if that `foo()` is a `true` like
61 // all the ones above use? Nothing. It makes neither suggestion in
63 fn asteroids() -> impl FnOnce() -> bool {
64 { foo(); } || { true } //~ ERROR E0308