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/resolve/privacy-enum-ctor.stderr | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/test/ui/resolve') diff --git a/src/test/ui/resolve/privacy-enum-ctor.stderr b/src/test/ui/resolve/privacy-enum-ctor.stderr index 8e08f124d68..01e6488de53 100644 --- a/src/test/ui/resolve/privacy-enum-ctor.stderr +++ b/src/test/ui/resolve/privacy-enum-ctor.stderr @@ -171,7 +171,9 @@ LL | Unit, | ---- `Z::Unit` defined here ... LL | let _ = Z::Unit(); - | ^^^^^^^^^ not a function + | ^^^^^^^-- + | | + | call expression requires function help: `Z::Unit` is a unit variant, you need to write it without the parenthesis | LL | let _ = Z::Unit; @@ -193,7 +195,9 @@ LL | Unit, | ---- `m::E::Unit` defined here ... LL | let _: E = m::E::Unit(); - | ^^^^^^^^^^^^ not a function + | ^^^^^^^^^^-- + | | + | call expression requires function help: `m::E::Unit` is a unit variant, you need to write it without the parenthesis | LL | let _: E = m::E::Unit; @@ -215,7 +219,9 @@ LL | Unit, | ---- `E::Unit` defined here ... LL | let _: E = E::Unit(); - | ^^^^^^^^^ not a function + | ^^^^^^^-- + | | + | call expression requires function help: `E::Unit` is a unit variant, you need to write it without the parenthesis | LL | let _: E = E::Unit; -- cgit 1.4.1-3-g733a5