about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/suggestions/suggest-add-self-issue-128042.rs12
-rw-r--r--tests/ui/suggestions/suggest-add-self-issue-128042.stderr22
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/ui/suggestions/suggest-add-self-issue-128042.rs b/tests/ui/suggestions/suggest-add-self-issue-128042.rs
new file mode 100644
index 00000000000..f94d166c496
--- /dev/null
+++ b/tests/ui/suggestions/suggest-add-self-issue-128042.rs
@@ -0,0 +1,12 @@
+struct Thing {
+    state: u8,
+}
+
+impl Thing {
+    fn oof(*mut Self) { //~ ERROR expected parameter name, found `*`
+        self.state = 1;
+        //~^ ERROR expected value, found module `self`
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/suggestions/suggest-add-self-issue-128042.stderr b/tests/ui/suggestions/suggest-add-self-issue-128042.stderr
new file mode 100644
index 00000000000..49ac1563250
--- /dev/null
+++ b/tests/ui/suggestions/suggest-add-self-issue-128042.stderr
@@ -0,0 +1,22 @@
+error: expected parameter name, found `*`
+  --> $DIR/suggest-add-self-issue-128042.rs:6:12
+   |
+LL |     fn oof(*mut Self) {
+   |            ^ expected parameter name
+
+error[E0424]: expected value, found module `self`
+  --> $DIR/suggest-add-self-issue-128042.rs:7:9
+   |
+LL |     fn oof(*mut Self) {
+   |        --- this function doesn't have a `self` parameter
+LL |         self.state = 1;
+   |         ^^^^ `self` value is a keyword only available in methods with a `self` parameter
+   |
+help: add a `self` receiver parameter to make the associated `fn` a method
+   |
+LL |     fn oof(&self, *mut Self) {
+   |            ++++++
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0424`.