diff options
Diffstat (limited to 'tests/ui/parser/attribute')
| -rw-r--r-- | tests/ui/parser/attribute/attr-pat-struct-rest.rs | 8 | ||||
| -rw-r--r-- | tests/ui/parser/attribute/attr-pat-struct-rest.stderr | 10 |
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/parser/attribute/attr-pat-struct-rest.rs b/tests/ui/parser/attribute/attr-pat-struct-rest.rs new file mode 100644 index 00000000000..b2bfcf82df8 --- /dev/null +++ b/tests/ui/parser/attribute/attr-pat-struct-rest.rs @@ -0,0 +1,8 @@ +// #81282: Attributes are not allowed on struct field rest patterns (the ..). + +struct S {} + +fn main() { + let S { #[cfg(any())] .. } = S {}; + //~^ ERROR expected identifier, found `..` +} diff --git a/tests/ui/parser/attribute/attr-pat-struct-rest.stderr b/tests/ui/parser/attribute/attr-pat-struct-rest.stderr new file mode 100644 index 00000000000..f72c54973fc --- /dev/null +++ b/tests/ui/parser/attribute/attr-pat-struct-rest.stderr @@ -0,0 +1,10 @@ +error: expected identifier, found `..` + --> $DIR/attr-pat-struct-rest.rs:6:27 + | +LL | let S { #[cfg(any())] .. } = S {}; + | - ^^ expected identifier + | | + | while parsing the fields for this pattern + +error: aborting due to 1 previous error + |
