From f3e9b1a703203be4f375dc5fa3950b642a156ec7 Mon Sep 17 00:00:00 2001 From: "Zack M. Davis" Date: Sat, 10 Nov 2018 20:46:05 -0800 Subject: 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. --- src/test/ui/error-codes/E0618.stderr | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/test/ui/error-codes') diff --git a/src/test/ui/error-codes/E0618.stderr b/src/test/ui/error-codes/E0618.stderr index ef7ace44d59..3bcc83e01c1 100644 --- a/src/test/ui/error-codes/E0618.stderr +++ b/src/test/ui/error-codes/E0618.stderr @@ -5,7 +5,9 @@ LL | Entry, | ----- `X::Entry` defined here ... LL | X::Entry(); - | ^^^^^^^^^^ not a function + | ^^^^^^^^-- + | | + | call expression requires function help: `X::Entry` is a unit variant, you need to write it without the parenthesis | LL | X::Entry; @@ -17,7 +19,9 @@ error[E0618]: expected function, found `i32` LL | let x = 0i32; | - `i32` defined here LL | x(); - | ^^^ not a function + | ^-- + | | + | call expression requires function error: aborting due to 2 previous errors -- cgit 1.4.1-3-g733a5