about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-01-01 19:14:00 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-01-01 23:59:32 +0300
commit3df500db29b6f50c5c74e7735a9e007ae90206d7 (patch)
tree5fd96ec9da7e57075dc8080d3874418134409a98 /src/test
parentcae164753f557f668cb75610abda4f790981e5e6 (diff)
downloadrust-3df500db29b6f50c5c74e7735a9e007ae90206d7.tar.gz
rust-3df500db29b6f50c5c74e7735a9e007ae90206d7.zip
syntax: Fix regression in diagnostics for patterns in trait method parameters
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/E0642.rs2
-rw-r--r--src/test/ui/E0642.stderr12
2 files changed, 13 insertions, 1 deletions
diff --git a/src/test/ui/E0642.rs b/src/test/ui/E0642.rs
index 8b74e5abe19..cfbd362c1da 100644
--- a/src/test/ui/E0642.rs
+++ b/src/test/ui/E0642.rs
@@ -6,6 +6,8 @@ trait T {
 
     fn bar((x, y): (i32, i32)) {} //~ ERROR patterns aren't allowed in methods without bodies
 
+    fn method(S { .. }: 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
diff --git a/src/test/ui/E0642.stderr b/src/test/ui/E0642.stderr
index c3a230d5acf..4c82a6cbd21 100644
--- a/src/test/ui/E0642.stderr
+++ b/src/test/ui/E0642.stderr
@@ -18,6 +18,16 @@ help: give this argument a name or use an underscore to ignore it
 LL |     fn bar(_: (i32, i32)) {} //~ ERROR patterns aren't allowed in methods without bodies
    |            ^
 
-error: aborting due to 2 previous errors
+error[E0642]: patterns aren't allowed in methods without bodies
+  --> $DIR/E0642.rs:9:15
+   |
+LL |     fn method(S { .. }: S) {} //~ ERROR patterns aren't allowed in methods without bodies
+   |               ^^^^^^^^
+help: give this argument a name or use an underscore to ignore it
+   |
+LL |     fn method(_: S) {} //~ ERROR patterns aren't allowed in methods without bodies
+   |               ^
+
+error: aborting due to 3 previous errors
 
 For more information about this error, try `rustc --explain E0642`.