about summary refs log tree commit diff
path: root/tests/ui/parser/suggest-self-in-bare-function.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/parser/suggest-self-in-bare-function.rs')
-rw-r--r--tests/ui/parser/suggest-self-in-bare-function.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/ui/parser/suggest-self-in-bare-function.rs b/tests/ui/parser/suggest-self-in-bare-function.rs
new file mode 100644
index 00000000000..e7f2a12bcd0
--- /dev/null
+++ b/tests/ui/parser/suggest-self-in-bare-function.rs
@@ -0,0 +1,25 @@
+// We should not suggest `self` in bare functions.
+// And a note for RFC 1685 should not be shown.
+// See #144968
+
+//@ edition:2018
+
+fn is_even(value) -> bool { //~ ERROR expected one of `:`, `@`, or `|`, found `)`
+    value % 2 == 0
+}
+
+struct S;
+
+impl S {
+    fn is_even(value) -> bool { //~ ERROR expected one of `:`, `@`, or `|`, found `)`
+        value % 2 == 0
+    }
+}
+
+trait T {
+    fn is_even(value) -> bool { //~ ERROR expected one of `:`, `@`, or `|`, found `)`
+        value % 2 == 0
+    }
+}
+
+fn main() {}