about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/errors.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2025-02-15 20:14:58 +0100
committerGitHub <noreply@github.com>2025-02-15 20:14:58 +0100
commit06b2f6208a1ad27dc4e13372ff5aecead18d53fd (patch)
tree677e8b1b1a452b7e33c25151112828a3fde29e2b /compiler/rustc_parse/src/errors.rs
parent522c8f76173690b6fe3e9ab13af6988785503422 (diff)
parent3f09a2054921708ac8288ac9912885dbe66682ec (diff)
downloadrust-06b2f6208a1ad27dc4e13372ff5aecead18d53fd.tar.gz
rust-06b2f6208a1ad27dc4e13372ff5aecead18d53fd.zip
Rollup merge of #136490 - Skepfyr:no-field-rest-pattern-attrs, r=compiler-errors
Do not allow attributes on struct field rest patterns

Fixes #81282.

This removes support for attributes on struct field rest patterns (the `..` bit) from the parser. Previously any attributes were being parsed but dropped from the AST, so didn't work and were deleted by rustfmt.

This needs an equivalent change to the reference but I wanted to see how this PR is received first.
The error message it produces isn't great, however it does match the error you get if you try to add attributes to .. in struct expressions atm, although I can understand wanting to do better given this was previously accepted. I think I could move attribute parsing back up to where it was and then emit a specific new error for this case, however I might need some guidance as this is the first time I've messed around inside the compiler.

While this is technically breaking I don't think it's much of an issue: attributes in this position don't currently do anything and rustfmt outright deletes them, meaning it's incredibly unlikely to affect anyone. I have already made the equivalent change to *add* support for attributes (mostly) but the conversation in the linked issue suggested it would be more reasonable to just remove them (and pointed out it's much easier to add support later if we realise we need them).
Diffstat (limited to 'compiler/rustc_parse/src/errors.rs')
0 files changed, 0 insertions, 0 deletions