about summary refs log tree commit diff
path: root/src/test/ui/error-codes
diff options
context:
space:
mode:
authorZack M. Davis <code@zackmdavis.net>2018-11-10 20:46:05 -0800
committerZack M. Davis <code@zackmdavis.net>2018-11-10 22:12:33 -0800
commitf3e9b1a703203be4f375dc5fa3950b642a156ec7 (patch)
tree886d8868b9779311babed22caa503ec442e844d7 /src/test/ui/error-codes
parent6408162ea13446852cb45d9e781e64ba85ec7bb1 (diff)
downloadrust-f3e9b1a703203be4f375dc5fa3950b642a156ec7.tar.gz
rust-f3e9b1a703203be4f375dc5fa3950b642a156ec7.zip
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.
Diffstat (limited to 'src/test/ui/error-codes')
-rw-r--r--src/test/ui/error-codes/E0618.stderr8
1 files changed, 6 insertions, 2 deletions
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