rust/src/test/ui/parse-error-correct.stderr
Zack M. Davis f3e9b1a703 in which the E0618 "expected function" diagnostic gets a makeover
Now the main span focuses on the erroneous not-a-function callee,
while showing the entire call expression is relegated to a secondary
span. In the case where the erroneous callee is itself a call, we
point out the definition, and, if the call expression spans multiple
lines, tentatively suggest a semicolon (because we suspect that the
"outer" call is actually supposed to be a tuple).

The new `bug!` assertion is, in fact, safe (`confirm_builtin_call` is
only called by `check_call`, which is only called with a first arg of
kind `ExprKind::Call` in `check_expr_kind`).

Resolves #51055.
2018-11-10 22:12:33 -08:00

33 lines
1 KiB
Text

error: unexpected token: `;`
--> $DIR/parse-error-correct.rs:18:15
|
LL | let x = y.; //~ ERROR unexpected token
| ^
error: unexpected token: `(`
--> $DIR/parse-error-correct.rs:19:15
|
LL | let x = y.(); //~ ERROR unexpected token
| ^
error[E0618]: expected function, found `{integer}`
--> $DIR/parse-error-correct.rs:19:13
|
LL | let y = 42;
| - `{integer}` defined here
LL | let x = y.; //~ ERROR unexpected token
LL | let x = y.(); //~ ERROR unexpected token
| ^---
| |
| call expression requires function
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> $DIR/parse-error-correct.rs:21:15
|
LL | let x = y.foo; //~ ERROR `{integer}` is a primitive type and therefore doesn't have fields [E061
| ^^^
error: aborting due to 4 previous errors
Some errors occurred: E0610, E0618.
For more information about an error, try `rustc --explain E0610`.