-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Do not allow attributes on struct field rest patterns #136490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This removes support for attributes on struct field rest patterns (the `..`) from the parser. Previously they were being parsed but dropped from the AST, so didn't work and were deleted by rustfmt.
rustbot has assigned @compiler-errors. Use |
This is probably more of a "bug fix", in that we should have been rejecting attributes on struct field rest pattern but we didn't. This may be worth a crater run (even if just for awareness to ping anyone who accidentally accepted this), and possibly a T-lang FCP. @rustbot label: +I-lang-nominated +I-lang-easy-decision |
@bors try |
… r=<try> Do not allow attributes on struct field rest patterns Fixes rust-lang#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).
☀️ Try build successful - checks-actions |
@craterbot check |
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🎉 Experiment
|
Both regressions (and the 3 fixes) look entirely unrelated to me. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
@rfcbot reviewed |
1 similar comment
@rfcbot reviewed |
@rfcbot reviewed Feels in line with our prior practice of removing attributes that were not intended to be accepted. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
@bors r+ |
Can you please post a PR to the reference to update it, too? |
rustc never properly supported attributes in this position so this just removes them entirely. See rustc change at: rust-lang/rust#136490
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#127581 (Fix crate name validation) - rust-lang#136490 (Do not allow attributes on struct field rest patterns) - rust-lang#136808 (Try to recover from path sep error in type parsing) - rust-lang#137055 (rustdoc: Properly restore search input placeholder) - rust-lang#137068 (fix(rustdoc): Fixed `Copy Item Path` in rust doc) - rust-lang#137070 (Do not generate invalid links in job summaries) - rust-lang#137074 (compiletest: add `{ignore,only}-rustc_abi-x86-sse2` directives) - rust-lang#137076 (triagebot.toml: ping me on changes to `tests/rustdoc-json`) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#127581 (Fix crate name validation) - rust-lang#136490 (Do not allow attributes on struct field rest patterns) - rust-lang#136808 (Try to recover from path sep error in type parsing) - rust-lang#137055 (rustdoc: Properly restore search input placeholder) - rust-lang#137068 (fix(rustdoc): Fixed `Copy Item Path` in rust doc) - rust-lang#137070 (Do not generate invalid links in job summaries) - rust-lang#137074 (compiletest: add `{ignore,only}-rustc_abi-x86-sse2` directives) - rust-lang#137076 (triagebot.toml: ping me on changes to `tests/rustdoc-json`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#136490 - Skepfyr:no-field-rest-pattern-attrs, r=compiler-errors Do not allow attributes on struct field rest patterns Fixes rust-lang#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).
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).