-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Tracking issue for #![register_attr]
#66080
Comments
Support registering inert attributes and attribute tools using crate-level attributes And remove `#[feature(custom_attribute)]`. (`rustc_plugin::Registry::register_attribute` is not removed yet, I'll do it in a follow up PR.) ```rust #![register_attr(my_attr)] #![register_tool(my_tool)] #[my_attr] // OK #[my_tool::anything] // OK fn main() {} ``` --- Some tools (`rustfmt` and `clippy`) used in tool attributes are hardcoded in the compiler. We need some way to introduce them without hardcoding as well. This PR introduces a way to do it with a crate level attribute. The previous attempt to introduce them through command line (#57921) met some resistance. This probably needs to go through an RFC before stabilization. However, I'd prefer to land *this* PR without an RFC to able to remove `#[feature(custom_attribute)]` and `Registry::register_attribute` while also providing a replacement. --- `register_attr` is a direct replacement for `#![feature(custom_attribute)]` (#29642), except it doesn't rely on implicit fallback from unresolved attributes to custom attributes (which was always hacky and is the primary reason for the removal of `custom_attribute`) and requires registering the attribute explicitly. It's not clear whether it should go through stabilization or not. It's quite possible that all the uses should migrate to `#![register_tool]` (#66079) instead. --- Details: - The naming is `register_attr`/`register_tool` rather than some `register_attributes` (plural, no abbreviation) for consistency with already existing attributes like `cfg_attr`, or `feature`, etc. --- Previous attempt: #57921 cc #44690 Tracking issues: #66079 (`register_tool`), #66080 (`register_attr`) Closes #29642
…sper rustc_plugin: Remove `Registry::register_attribute` Legacy plugins cannot register inert attributes anymore. The preferred replacement is to use `register_tool` ([tracking issue](rust-lang#66079)). ```rust #![register_tool(servo)] #[servo::must_root] struct S; ``` The more direct replacement is `register_attribute` ([tracking issue](rust-lang#66080)) ```rust #![register_attr(must_root)] #[must_root] struct S; ``` , but it requires registering each attribute individually rather than registering the tool once, and is more likely to be removed rather than stabilized.
…sper rustc_plugin: Remove `Registry::register_attribute` Legacy plugins cannot register inert attributes anymore. The preferred replacement is to use `register_tool` ([tracking issue](rust-lang#66079)). ```rust #![register_tool(servo)] #[servo::must_root] struct S; ``` The more direct replacement is `register_attribute` ([tracking issue](rust-lang#66080)) ```rust #![register_attr(must_root)] #[must_root] struct S; ``` , but it requires registering each attribute individually rather than registering the tool once, and is more likely to be removed rather than stabilized.
We discussed this in today's @rust-lang/lang meeting, and we agreed: anything new should be scoped, and anything existing we need to support for backwards compatibility shouldn't require calling @rfcbot close |
Team member @joshtriplett has proposed to close this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
@rfcbot reviewed |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
The final comment period, with a disposition to close, 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. |
Remove `register_attr` feature Closes rust-lang#66080 Signed-off-by: Yuki Okushi <jtitor@2k36.org>
This is a direct replacement for now removed
#![feature(custom_attribute)]
(#29642), except it doesn't rely on implicit fallback from unresolved attributes to custom attributes (which was always hacky and is the primary reason for the removal ofcustom_attribute
) and requires registering the attribute explicitly.It's not yet clear whether this should go through stabilization or not.
It's quite possible that all the uses should migrate to
#![register_tool]
(#66079) instead.The text was updated successfully, but these errors were encountered: