about summary refs log tree commit diff
path: root/src/test/ui/resolve
diff options
context:
space:
mode:
authoryukang <moorekang@gmail.com>2022-10-26 00:15:47 +0800
committeryukang <moorekang@gmail.com>2022-10-26 00:45:29 +0800
commit32a2f0dddb7aae3bef2939af5079eb2bcbfdf6c5 (patch)
tree48ccaf5cb2728f968bc47bbb8881ef7a095f000e /src/test/ui/resolve
parent9be2f35a4c1ed1b04aa4a6945b64763f599259ff (diff)
suggest calling the method of the same name when method not found
Diffstat (limited to 'src/test/ui/resolve')
-rw-r--r--src/test/ui/resolve/issue-103474.rs16
-rw-r--r--src/test/ui/resolve/issue-103474.stderr20
-rw-r--r--src/test/ui/resolve/issue-2356.stderr4
3 files changed, 38 insertions, 2 deletions
diff --git a/src/test/ui/resolve/issue-103474.rs b/src/test/ui/resolve/issue-103474.rs
new file mode 100644
index 00000000000..408139ca011
--- /dev/null
+++ b/src/test/ui/resolve/issue-103474.rs
@@ -0,0 +1,16 @@
+struct S {}
+impl S {
+    fn first(&self) {}
+
+    fn second(&self) {
+        first()
+        //~^ ERROR cannot find function `first` in this scope
+    }
+
+    fn third(&self) {
+        no_method_err()
+        //~^ ERROR cannot find function `no_method_err` in this scope
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/resolve/issue-103474.stderr b/src/test/ui/resolve/issue-103474.stderr
new file mode 100644
index 00000000000..78fa13fbd2e
--- /dev/null
+++ b/src/test/ui/resolve/issue-103474.stderr
@@ -0,0 +1,20 @@
+error[E0425]: cannot find function `first` in this scope
+  --> $DIR/issue-103474.rs:6:9
+   |
+LL |         first()
+   |         ^^^^^ not found in this scope
+   |
+help: consider using the associated function
+   |
+LL |         self.first()
+   |         +++++
+
+error[E0425]: cannot find function `no_method_err` in this scope
+  --> $DIR/issue-103474.rs:11:9
+   |
+LL |         no_method_err()
+   |         ^^^^^^^^^^^^^ not found in this scope
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/ui/resolve/issue-2356.stderr b/src/test/ui/resolve/issue-2356.stderr
index e7c53ff44e6..36f3da7c955 100644
--- a/src/test/ui/resolve/issue-2356.stderr
+++ b/src/test/ui/resolve/issue-2356.stderr
@@ -85,7 +85,7 @@ LL |         static_method();
 help: consider using the associated function
    |
 LL |         Self::static_method();
-   |         ~~~~~~~~~~~~~~~~~~~
+   |         ++++++
 
 error[E0425]: cannot find function `purr` in this scope
   --> $DIR/issue-2356.rs:54:9
@@ -114,7 +114,7 @@ LL |     grow_older();
 help: consider using the associated function
    |
 LL |     Self::grow_older();
-   |     ~~~~~~~~~~~~~~~~
+   |     ++++++
 
 error[E0425]: cannot find function `shave` in this scope
   --> $DIR/issue-2356.rs:74:5