about summary refs log tree commit diff
path: root/src/test/ui/error-codes
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-10-06 07:07:36 +0200
committerGitHub <noreply@github.com>2022-10-06 07:07:36 +0200
commita9b3441c178191b4d33f9fe6b8e937894baff7c4 (patch)
treefef3634ad1b6696f98e620986ac6f26f8486bd14 /src/test/ui/error-codes
parent6d8cea63db8761d8a7e5549e407e5bd60b5c3eb1 (diff)
parentea3837072c44aaafd4156755fde5c4b43b8f3558 (diff)
downloadrust-a9b3441c178191b4d33f9fe6b8e937894baff7c4.tar.gz
rust-a9b3441c178191b4d33f9fe6b8e937894baff7c4.zip
Rollup merge of #102694 - compiler-errors:fn-to-method, r=davidtwco
Suggest calling method if fn does not exist

I tried to split this up into two commits, the first where we stash the resolution error until typeck (which causes a bunch of diagnostics changes because the ordering of error messages change), then the second commit is the actual logic that actually implements the suggestion.

I am not in love with the presentation of the suggestion, so I could use some advice for how to format the actual messaging.

r? diagnostics

Fixes #102518
Diffstat (limited to 'src/test/ui/error-codes')
-rw-r--r--src/test/ui/error-codes/E0423.stderr22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/test/ui/error-codes/E0423.stderr b/src/test/ui/error-codes/E0423.stderr
index 8f2ef8c8e6b..ac70d905d35 100644
--- a/src/test/ui/error-codes/E0423.stderr
+++ b/src/test/ui/error-codes/E0423.stderr
@@ -26,6 +26,17 @@ help: surround the struct literal with parentheses
 LL |     for _ in (std::ops::Range { start: 0, end: 10 }) {}
    |              +                                     +
 
+error[E0423]: expected value, found struct `T`
+  --> $DIR/E0423.rs:14:8
+   |
+LL |     if T {} == T {} { println!("Ok"); }
+   |        ^ not a value
+   |
+help: surround the struct literal with parentheses
+   |
+LL |     if (T {}) == T {} { println!("Ok"); }
+   |        +    +
+
 error[E0423]: expected function, tuple struct or tuple variant, found struct `Foo`
   --> $DIR/E0423.rs:4:13
    |
@@ -47,17 +58,6 @@ help: a function with a similar name exists
 LL |     let f = foo();
    |             ~~~
 
-error[E0423]: expected value, found struct `T`
-  --> $DIR/E0423.rs:14:8
-   |
-LL |     if T {} == T {} { println!("Ok"); }
-   |        ^ not a value
-   |
-help: surround the struct literal with parentheses
-   |
-LL |     if (T {}) == T {} { println!("Ok"); }
-   |        +    +
-
 error: aborting due to 5 previous errors
 
 For more information about this error, try `rustc --explain E0423`.