about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/destructuring-assignment/struct_destructure_fail.stderr4
-rw-r--r--src/test/ui/error-codes/E0027.rs9
-rw-r--r--src/test/ui/error-codes/E0027.stderr36
3 files changed, 44 insertions, 5 deletions
diff --git a/src/test/ui/destructuring-assignment/struct_destructure_fail.stderr b/src/test/ui/destructuring-assignment/struct_destructure_fail.stderr
index 81661a357e7..c0955ef8b06 100644
--- a/src/test/ui/destructuring-assignment/struct_destructure_fail.stderr
+++ b/src/test/ui/destructuring-assignment/struct_destructure_fail.stderr
@@ -32,11 +32,11 @@ LL |     Struct { a, _ } = Struct { a: 1, b: 2 };
    |
 help: include the missing field in the pattern
    |
-LL |     Struct { a, b, _ } = Struct { a: 1, b: 2 };
+LL |     Struct { a, b _ } = Struct { a: 1, b: 2 };
    |               ^^^
 help: if you don't care about this missing field, you can explicitly ignore it
    |
-LL |     Struct { a, .., _ } = Struct { a: 1, b: 2 };
+LL |     Struct { a, .. _ } = Struct { a: 1, b: 2 };
    |               ^^^^
 
 error: aborting due to 5 previous errors
diff --git a/src/test/ui/error-codes/E0027.rs b/src/test/ui/error-codes/E0027.rs
index 8d08e178934..e7eca1ce5af 100644
--- a/src/test/ui/error-codes/E0027.rs
+++ b/src/test/ui/error-codes/E0027.rs
@@ -3,6 +3,7 @@ struct Dog {
     age: u32,
 }
 
+
 fn main() {
     let d = Dog { name: "Rusty".to_string(), age: 8 };
 
@@ -10,6 +11,14 @@ fn main() {
         Dog { age: x } => {} //~ ERROR pattern does not mention field `name`
     }
     match d {
+        // trailing comma
+        Dog { name: x, } => {} //~ ERROR pattern does not mention field `age`
+    }
+    match d {
+        // trailing comma with weird whitespace
+        Dog { name: x  , } => {} //~ ERROR pattern does not mention field `age`
+    }
+    match d {
         Dog {} => {} //~ ERROR pattern does not mention fields `name`, `age`
     }
 }
diff --git a/src/test/ui/error-codes/E0027.stderr b/src/test/ui/error-codes/E0027.stderr
index cf0ff631148..694bbc358fe 100644
--- a/src/test/ui/error-codes/E0027.stderr
+++ b/src/test/ui/error-codes/E0027.stderr
@@ -1,5 +1,5 @@
 error[E0027]: pattern does not mention field `name`
-  --> $DIR/E0027.rs:10:9
+  --> $DIR/E0027.rs:11:9
    |
 LL |         Dog { age: x } => {}
    |         ^^^^^^^^^^^^^^ missing field `name`
@@ -13,8 +13,38 @@ help: if you don't care about this missing field, you can explicitly ignore it
 LL |         Dog { age: x, .. } => {}
    |                     ^^^^
 
+error[E0027]: pattern does not mention field `age`
+  --> $DIR/E0027.rs:15:9
+   |
+LL |         Dog { name: x, } => {}
+   |         ^^^^^^^^^^^^^^^^ missing field `age`
+   |
+help: include the missing field in the pattern
+   |
+LL |         Dog { name: x, age } => {}
+   |                      ^^^^^
+help: if you don't care about this missing field, you can explicitly ignore it
+   |
+LL |         Dog { name: x, .. } => {}
+   |                      ^^^^
+
+error[E0027]: pattern does not mention field `age`
+  --> $DIR/E0027.rs:19:9
+   |
+LL |         Dog { name: x  , } => {}
+   |         ^^^^^^^^^^^^^^^^^^ missing field `age`
+   |
+help: include the missing field in the pattern
+   |
+LL |         Dog { name: x, age } => {}
+   |                      ^^^^^
+help: if you don't care about this missing field, you can explicitly ignore it
+   |
+LL |         Dog { name: x, .. } => {}
+   |                      ^^^^
+
 error[E0027]: pattern does not mention fields `name`, `age`
-  --> $DIR/E0027.rs:13:9
+  --> $DIR/E0027.rs:22:9
    |
 LL |         Dog {} => {}
    |         ^^^^^^ missing fields `name`, `age`
@@ -28,6 +58,6 @@ help: if you don't care about these missing fields, you can explicitly ignore th
 LL |         Dog { .. } => {}
    |             ^^^^^^
 
-error: aborting due to 2 previous errors
+error: aborting due to 4 previous errors
 
 For more information about this error, try `rustc --explain E0027`.