]> git.lizzy.rs Git - rust.git/blob - src/test/ui/error-codes/E0423.stderr
Suggest `if let`/`let_else` for refutable pat in `let`
[rust.git] / src / test / ui / error-codes / E0423.stderr
1 error: struct literals are not allowed here
2   --> $DIR/E0423.rs:12:32
3    |
4 LL |     if let S { x: _x, y: 2 } = S { x: 1, y: 2 } { println!("Ok"); }
5    |                                ^^^^^^^^^^^^^^^^
6    |
7 help: surround the struct literal with parentheses
8    |
9 LL |     if let S { x: _x, y: 2 } = (S { x: 1, y: 2 }) { println!("Ok"); }
10    |                                +                +
11
12 error: expected expression, found `==`
13   --> $DIR/E0423.rs:14:13
14    |
15 LL |     if T {} == T {} { println!("Ok"); }
16    |             ^^ expected expression
17
18 error: struct literals are not allowed here
19   --> $DIR/E0423.rs:20:14
20    |
21 LL |     for _ in std::ops::Range { start: 0, end: 10 } {}
22    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23    |
24 help: surround the struct literal with parentheses
25    |
26 LL |     for _ in (std::ops::Range { start: 0, end: 10 }) {}
27    |              +                                     +
28
29 error[E0423]: expected function, tuple struct or tuple variant, found struct `Foo`
30   --> $DIR/E0423.rs:4:13
31    |
32 LL |     struct Foo { a: bool };
33    |     ---------------------- `Foo` defined here
34 LL | 
35 LL |     let f = Foo();
36    |             ^^^^^
37 ...
38 LL | fn foo() {
39    | -------- similarly named function `foo` defined here
40    |
41 help: use struct literal syntax instead
42    |
43 LL |     let f = Foo { a: val };
44    |             ~~~~~~~~~~~~~~
45 help: a function with a similar name exists
46    |
47 LL |     let f = foo();
48    |             ~~~
49
50 error[E0423]: expected value, found struct `T`
51   --> $DIR/E0423.rs:14:8
52    |
53 LL |     if T {} == T {} { println!("Ok"); }
54    |        ^ not a value
55    |
56 help: surround the struct literal with parentheses
57    |
58 LL |     if (T {}) == T {} { println!("Ok"); }
59    |        +    +
60
61 error: aborting due to 5 previous errors
62
63 For more information about this error, try `rustc --explain E0423`.