diff options
| author | Michael Goulet <michael@errs.io> | 2022-08-13 14:10:12 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-13 14:10:12 -0700 |
| commit | 29f905bfafed0c6821f4973287593803fa033b80 (patch) | |
| tree | ccd7af0f0bf00840bb0f51f0f6bb40fb27c9484d /src/test/ui/parser | |
| parent | 7a34d392787473f62dda3028a2c94fa88cc71c70 (diff) | |
| parent | 52a15180d2bc193aceea7302dd175f2c872df340 (diff) | |
Rollup merge of #100475 - chenyukang:fix-100461, r=fee1-dead
Give a helpful diagnostic when the next struct field has an attribute Fixes #100461
Diffstat (limited to 'src/test/ui/parser')
| -rw-r--r-- | src/test/ui/parser/struct-filed-with-attr.fixed | 18 | ||||
| -rw-r--r-- | src/test/ui/parser/struct-filed-with-attr.rs | 18 | ||||
| -rw-r--r-- | src/test/ui/parser/struct-filed-with-attr.stderr | 8 |
3 files changed, 44 insertions, 0 deletions
diff --git a/src/test/ui/parser/struct-filed-with-attr.fixed b/src/test/ui/parser/struct-filed-with-attr.fixed new file mode 100644 index 00000000000..a799ec8ca2e --- /dev/null +++ b/src/test/ui/parser/struct-filed-with-attr.fixed @@ -0,0 +1,18 @@ +// Issue: 100461, Try to give a helpful diagnostic even when the next struct field has an attribute. +// run-rustfix + +struct Feelings { + owo: bool, + //~^ ERROR expected `,`, or `}`, found `#` + #[allow(unused)] + uwu: bool, +} + +impl Feelings { + #[allow(unused)] + fn hmm(&self) -> bool { + self.owo + } +} + +fn main() { } diff --git a/src/test/ui/parser/struct-filed-with-attr.rs b/src/test/ui/parser/struct-filed-with-attr.rs new file mode 100644 index 00000000000..bfc78e15b5b --- /dev/null +++ b/src/test/ui/parser/struct-filed-with-attr.rs @@ -0,0 +1,18 @@ +// Issue: 100461, Try to give a helpful diagnostic even when the next struct field has an attribute. +// run-rustfix + +struct Feelings { + owo: bool + //~^ ERROR expected `,`, or `}`, found `#` + #[allow(unused)] + uwu: bool, +} + +impl Feelings { + #[allow(unused)] + fn hmm(&self) -> bool { + self.owo + } +} + +fn main() { } diff --git a/src/test/ui/parser/struct-filed-with-attr.stderr b/src/test/ui/parser/struct-filed-with-attr.stderr new file mode 100644 index 00000000000..c2cd7e82ead --- /dev/null +++ b/src/test/ui/parser/struct-filed-with-attr.stderr @@ -0,0 +1,8 @@ +error: expected `,`, or `}`, found `#` + --> $DIR/struct-filed-with-attr.rs:5:14 + | +LL | owo: bool + | ^ help: try adding a comma: `,` + +error: aborting due to previous error + |
