diff options
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/parse-fail/bind-struct-early-modifiers.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/issue-49257.rs | 4 | ||||
| -rw-r--r-- | src/test/ui/issue-49257.stderr | 37 |
3 files changed, 34 insertions, 9 deletions
diff --git a/src/test/parse-fail/bind-struct-early-modifiers.rs b/src/test/parse-fail/bind-struct-early-modifiers.rs index 25348a3bfd1..e9e76af11a5 100644 --- a/src/test/parse-fail/bind-struct-early-modifiers.rs +++ b/src/test/parse-fail/bind-struct-early-modifiers.rs @@ -13,7 +13,7 @@ fn main() { struct Foo { x: isize } match (Foo { x: 10 }) { - Foo { ref x: ref x } => {}, //~ ERROR expected `,`, found `:` + Foo { ref x: ref x } => {}, //~ ERROR expected `,` _ => {} } } diff --git a/src/test/ui/issue-49257.rs b/src/test/ui/issue-49257.rs index a3198492237..f288a2b2174 100644 --- a/src/test/ui/issue-49257.rs +++ b/src/test/ui/issue-49257.rs @@ -17,6 +17,8 @@ struct Point { x: u8, y: u8 } fn main() { let p = Point { x: 0, y: 0 }; + let Point { .., y, } = p; //~ ERROR expected `}`, found `,` let Point { .., y } = p; //~ ERROR expected `}`, found `,` - //~| ERROR pattern does not mention fields `x`, `y` + let Point { .., } = p; //~ ERROR expected `}`, found `,` + let Point { .. } = p; } diff --git a/src/test/ui/issue-49257.stderr b/src/test/ui/issue-49257.stderr index fec990764bb..40179832b49 100644 --- a/src/test/ui/issue-49257.stderr +++ b/src/test/ui/issue-49257.stderr @@ -1,15 +1,38 @@ error: expected `}`, found `,` --> $DIR/issue-49257.rs:20:19 | -LL | let Point { .., y } = p; //~ ERROR expected `}`, found `,` - | ^ `..` must be in the last position, and cannot have a trailing comma +LL | let Point { .., y, } = p; //~ ERROR expected `}`, found `,` + | --^ + | | | + | | expected `}` + | `..` must be at the end and cannot have a trailing comma +help: move the `..` to the end of the field list + | +LL | let Point { y, .. } = p; //~ ERROR expected `}`, found `,` + | -- ^^^^ -error[E0027]: pattern does not mention fields `x`, `y` - --> $DIR/issue-49257.rs:20:9 +error: expected `}`, found `,` + --> $DIR/issue-49257.rs:21:19 | LL | let Point { .., y } = p; //~ ERROR expected `}`, found `,` - | ^^^^^^^^^^^^^^^ missing fields `x`, `y` + | --^ + | | | + | | expected `}` + | `..` must be at the end and cannot have a trailing comma +help: move the `..` to the end of the field list + | +LL | let Point { y , .. } = p; //~ ERROR expected `}`, found `,` + | -- ^^^^^^ + +error: expected `}`, found `,` + --> $DIR/issue-49257.rs:22:19 + | +LL | let Point { .., } = p; //~ ERROR expected `}`, found `,` + | --^ + | | | + | | expected `}` + | | help: remove this comma + | `..` must be at the end and cannot have a trailing comma -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0027`. |
