-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Tracking issue for custom_attribute
features
#29642
Comments
custom_attribute
featurecustom_attribute
, rustc_attrs
features
Is this feature ever going to be stabilized? It is currently used by Rocket: rwf2/Rocket#19 (comment). Does Rocket have alternatives? |
Isn't this part of macros 2.0? that is |
Just found this ticket as serde's main documentation says to use it... |
It seems like serde relies on this feature a lot, see: https://serde.rs/attributes.html Is the plan to stabilize this? |
custom_attribute
, rustc_attrs
featurescustom_attribute
features
If this is no longer for |
Discussed in the @rust-lang/lang meeting: We believe we should remove the I think this is the main chunk of code that would change: rust/src/librustc_resolve/macros.rs Lines 316 to 322 in daa53a5
Nominating for @rust-lang/compiler mainly to see if anybody wants to follow-up or mentor this. |
There are some applicable mentoring instructions here: https://forge.rust-lang.org/stabilization-guide.html However, these instructions are oriented towards stabilizing a feature. We want to remove the feature. The main question mark for me is what sort of error we want to give. @cramertj had some ideas here. Also: cc @dtolnay in case you can think of any problems with removing this. =) |
This does not include |
The way If you search the rust codebase for
A usual error about unresolved name? (I'll happily do the necessary work, it's already in my work queue.) |
Interesting; could you elaborate a bit on the semantics of this? |
@Centril |
Thanks for the ping @nikomatsakis. I don't know of any code using custom_attribute and I don't have any reason to keep it. |
That sounds like a reasonable step forward. I did do a quick ripgrep through the rust sources and I was surprised by how many uses there are -- did you look more deeply at how e.g. Regarding the rustc internal tests, I suspect we could also get by by adding a few fixed attributes (e.g., But that wouldn't accommodate the |
Is this "lint API" for user defined lints? Can you elaborate on that (examples would be nice...)? |
It is. It is also nowhere near stable, of course. I don't really remember the details -- basically there is some hook and you can invoke some methods to inject lints that the compiler will later run. Here is the example that @SimonSapin gave: (I presume that Clippy doesn't use any custom attributes? cc @oli-obk @Manishearth) |
Clippy does, but it declares them beforehand, and they're all scoped under |
Oh, it doesn't, my bad. But they do have a use case there. Either way, we could scope them. |
Clippy can use "tool attributes" In the future such attributes are supposed to be registered through command line like |
Hmm... even if we had an API for defining lints, would that actually be of use since this depends on the HIR (and the type system... from what I can see, or at least it needs to operate on more than syntax?) ? (also I was hoping for a more "here is what I think using the API would look like for an end user on stable..." =P ) |
I submitted #57921 to move this story further. |
We probably should address the (Unless our plan is to somehow use the same new machinery for both cases...?) |
Second attempt: #66070. |
It errors in today’s Nightly: ```rust error[E0557]: feature has been removed --> components/script/lib.rs:9:12 | 9 | #![feature(on_unimplemented)] | ^^^^^^^^^^^^^^^^ feature has been removed error[E0658]: this is an internal attribute that will never be stable --> components/script/dom/bindings/conversions.rs:77:1 | 77 | #[rustc_on_unimplemented(message = "The IDL interface `{Self}` is not derived from `{T}`.")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: for more information, see rust-lang/rust#29642 = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable error: aborting due to 2 previous errors ```
Remove use of on_unimplemented It errors in today’s Nightly: ```rust error[E0557]: feature has been removed --> components/script/lib.rs:9:12 | 9 | #![feature(on_unimplemented)] | ^^^^^^^^^^^^^^^^ feature has been removed error[E0658]: this is an internal attribute that will never be stable --> components/script/dom/bindings/conversions.rs:77:1 | 77 | #[rustc_on_unimplemented(message = "The IDL interface `{Self}` is not derived from `{T}`.")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: for more information, see rust-lang/rust#29642 = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable error: aborting due to 2 previous errors ```
Part of RFC 572. This issue tracks stabilization/deprecation.
The text was updated successfully, but these errors were encountered: