rust/src/test/ui/error-codes/E0423.stderr
Esteban Küber b26ddb8af3 Point at local similarly named element and tweak references to variants
Point at the span for the definition of ADTs internal to the current
crate.

Look at the leading char of the ident to determine whether we're
expecting a likely fn or any of a fn, a tuple struct or a tuple variant.

Turn fn `add_typo_suggestion` into a `Resolver` method.
2019-10-27 11:50:43 -07:00

58 lines
1.8 KiB
Plaintext

error: struct literals are not allowed here
--> $DIR/E0423.rs:12:32
|
LL | if let S { x: _x, y: 2 } = S { x: 1, y: 2 } { println!("Ok"); }
| ^^^^^^^^^^^^^^^^
|
help: surround the struct literal with parentheses
|
LL | if let S { x: _x, y: 2 } = (S { x: 1, y: 2 }) { println!("Ok"); }
| ^ ^
error: expected expression, found `==`
--> $DIR/E0423.rs:14:13
|
LL | if T {} == T {} { println!("Ok"); }
| ^^ expected expression
error: struct literals are not allowed here
--> $DIR/E0423.rs:20:14
|
LL | for _ in std::ops::Range { start: 0, end: 10 } {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: surround the struct literal with parentheses
|
LL | for _ in (std::ops::Range { start: 0, end: 10 }) {}
| ^ ^
error[E0423]: expected function, tuple struct or tuple variant, found struct `Foo`
--> $DIR/E0423.rs:4:13
|
LL | struct Foo { a: bool };
| ---------------------- `Foo` defined here
LL |
LL | let f = Foo();
| ^^^
| |
| did you mean `Foo { /* fields */ }`?
| help: a function with a similar name exists (notice the capitalization): `foo`
...
LL | / fn foo() {
LL | | for _ in std::ops::Range { start: 0, end: 10 } {}
LL | |
LL | | }
| |_- similarly named function `foo` defined here
error[E0423]: expected value, found struct `T`
--> $DIR/E0423.rs:14:8
|
LL | if T {} == T {} { println!("Ok"); }
| ^---
| |
| help: surround the struct literal with parenthesis: `(T {})`
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0423`.