about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/no-patterns-in-args-2.rs4
-rw-r--r--src/test/compile-fail/no-patterns-in-args-macro.rs2
-rw-r--r--src/test/ui/E0642.rs15
-rw-r--r--src/test/ui/E0642.stderr16
4 files changed, 21 insertions, 16 deletions
diff --git a/src/test/compile-fail/no-patterns-in-args-2.rs b/src/test/compile-fail/no-patterns-in-args-2.rs
index 80e69679801..4d2412c34a5 100644
--- a/src/test/compile-fail/no-patterns-in-args-2.rs
+++ b/src/test/compile-fail/no-patterns-in-args-2.rs
@@ -11,9 +11,9 @@
 #![deny(patterns_in_fns_without_body)]
 
 trait Tr {
-    fn f1(mut arg: u8); //~ ERROR patterns aren't allowed in trait methods
+    fn f1(mut arg: u8); //~ ERROR patterns aren't allowed in methods without bodies
                         //~^ WARN was previously accepted
-    fn f2(&arg: u8); //~ ERROR patterns aren't allowed in trait methods
+    fn f2(&arg: u8); //~ ERROR patterns aren't allowed in methods without bodies
     fn g1(arg: u8); // OK
     fn g2(_: u8); // OK
     #[allow(anonymous_parameters)]
diff --git a/src/test/compile-fail/no-patterns-in-args-macro.rs b/src/test/compile-fail/no-patterns-in-args-macro.rs
index 546c40ecbd0..f85ce8f57ea 100644
--- a/src/test/compile-fail/no-patterns-in-args-macro.rs
+++ b/src/test/compile-fail/no-patterns-in-args-macro.rs
@@ -30,7 +30,7 @@ mod bad_pat {
     m!((bad, pat));
     //~^ ERROR patterns aren't allowed in function pointer types
     //~| ERROR patterns aren't allowed in foreign function declarations
-    //~| ERROR patterns aren't allowed in trait methods
+    //~| ERROR patterns aren't allowed in methods without bodies
 }
 
 fn main() {}
diff --git a/src/test/ui/E0642.rs b/src/test/ui/E0642.rs
index 837a9365271..58ccfc56ab7 100644
--- a/src/test/ui/E0642.rs
+++ b/src/test/ui/E0642.rs
@@ -8,12 +8,17 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-trait Foo {
-    fn foo((x, y): (i32, i32)); //~ ERROR patterns aren't allowed in trait methods
-}
+#[derive(Clone, Copy)]
+struct S;
+
+trait T {
+    fn foo((x, y): (i32, i32)); //~ ERROR patterns aren't allowed in methods without bodies
+
+    fn bar((x, y): (i32, i32)) {} //~ ERROR patterns aren't allowed in methods without bodies
 
-trait Bar {
-    fn bar((x, y): (i32, i32)) {} //~ ERROR patterns aren't allowed in trait methods
+    fn f(&ident: &S) {} // ok
+    fn g(&&ident: &&S) {} // ok
+    fn h(mut ident: S) {} // ok
 }
 
 fn main() {}
diff --git a/src/test/ui/E0642.stderr b/src/test/ui/E0642.stderr
index 1723e97b45e..34c163e2109 100644
--- a/src/test/ui/E0642.stderr
+++ b/src/test/ui/E0642.stderr
@@ -1,21 +1,21 @@
-error[E0642]: patterns aren't allowed in trait methods
-  --> $DIR/E0642.rs:12:12
+error[E0642]: patterns aren't allowed in methods without bodies
+  --> $DIR/E0642.rs:15:12
    |
-LL |     fn foo((x, y): (i32, i32)); //~ ERROR patterns aren't allowed in trait methods
+LL |     fn foo((x, y): (i32, i32)); //~ ERROR patterns aren't allowed in methods without bodies
    |            ^^^^^^
 help: give this argument a name or use an underscore to ignore it
    |
-LL |     fn foo(_: (i32, i32)); //~ ERROR patterns aren't allowed in trait methods
+LL |     fn foo(_: (i32, i32)); //~ ERROR patterns aren't allowed in methods without bodies
    |            ^
 
-error[E0642]: patterns aren't allowed in trait methods
-  --> $DIR/E0642.rs:16:12
+error[E0642]: patterns aren't allowed in methods without bodies
+  --> $DIR/E0642.rs:17:12
    |
-LL |     fn bar((x, y): (i32, i32)) {} //~ ERROR patterns aren't allowed in trait methods
+LL |     fn bar((x, y): (i32, i32)) {} //~ ERROR patterns aren't allowed in methods without bodies
    |            ^^^^^^
 help: give this argument a name or use an underscore to ignore it
    |
-LL |     fn bar(_: (i32, i32)) {} //~ ERROR patterns aren't allowed in trait methods
+LL |     fn bar(_: (i32, i32)) {} //~ ERROR patterns aren't allowed in methods without bodies
    |            ^
 
 error: aborting due to 2 previous errors