about summary refs log tree commit diff
path: root/src/test/ui/error-codes
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/error-codes')
-rw-r--r--src/test/ui/error-codes/E0642.fixed20
-rw-r--r--src/test/ui/error-codes/E0642.rs4
-rw-r--r--src/test/ui/error-codes/E0642.stderr6
3 files changed, 27 insertions, 3 deletions
diff --git a/src/test/ui/error-codes/E0642.fixed b/src/test/ui/error-codes/E0642.fixed
new file mode 100644
index 00000000000..fc6255e0274
--- /dev/null
+++ b/src/test/ui/error-codes/E0642.fixed
@@ -0,0 +1,20 @@
+// run-rustfix
+
+#![allow(unused)] // for rustfix
+
+#[derive(Clone, Copy)]
+struct S;
+
+trait T {
+    fn foo(_: (i32, i32)); //~ ERROR patterns aren't allowed in methods without bodies
+
+    fn bar(_: (i32, i32)) {} //~ ERROR patterns aren't allowed in methods without bodies
+
+    fn method(_: S) {} //~ ERROR patterns aren't allowed in methods without bodies
+
+    fn f(&ident: &S) {} // ok
+    fn g(&&ident: &&S) {} // ok
+    fn h(mut ident: S) {} // ok
+}
+
+fn main() {}
diff --git a/src/test/ui/error-codes/E0642.rs b/src/test/ui/error-codes/E0642.rs
index cfbd362c1da..5f85f3935e1 100644
--- a/src/test/ui/error-codes/E0642.rs
+++ b/src/test/ui/error-codes/E0642.rs
@@ -1,3 +1,7 @@
+// run-rustfix
+
+#![allow(unused)] // for rustfix
+
 #[derive(Clone, Copy)]
 struct S;
 
diff --git a/src/test/ui/error-codes/E0642.stderr b/src/test/ui/error-codes/E0642.stderr
index 45486a5d632..83fcac042b1 100644
--- a/src/test/ui/error-codes/E0642.stderr
+++ b/src/test/ui/error-codes/E0642.stderr
@@ -1,5 +1,5 @@
 error[E0642]: patterns aren't allowed in methods without bodies
-  --> $DIR/E0642.rs:5:12
+  --> $DIR/E0642.rs:9:12
    |
 LL |     fn foo((x, y): (i32, i32));
    |            ^^^^^^
@@ -10,7 +10,7 @@ LL |     fn foo(_: (i32, i32));
    |            ^
 
 error[E0642]: patterns aren't allowed in methods without bodies
-  --> $DIR/E0642.rs:7:12
+  --> $DIR/E0642.rs:11:12
    |
 LL |     fn bar((x, y): (i32, i32)) {}
    |            ^^^^^^
@@ -21,7 +21,7 @@ LL |     fn bar(_: (i32, i32)) {}
    |            ^
 
 error[E0642]: patterns aren't allowed in methods without bodies
-  --> $DIR/E0642.rs:9:15
+  --> $DIR/E0642.rs:13:15
    |
 LL |     fn method(S { .. }: S) {}
    |               ^^^^^^^^