-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
RFC: Feature gate unused attributes #572
Conversation
I would personally prefer the use of I unfortunately don't think that the unused attribute alternative would work. You could define a syntax extension called |
Me too, but we don't support that yet (and probably won't till post-1.0).
We make no guarantees about the stability of syntax extensions and other plugins in nightly builds. We can switch |
But this RFC is dealing with an issue that will only matter after 1.0. We can take that solution, and won't need to worry about changing the attribute syntax until we decide we want a new compiler-used attribute after 1.0. In any case, it's a pretty trivial change to make.
I think we still need a plausible story of how the solution to this RFC will interact with stabilized syntax extensions, since this RFC will have an impact on them. |
I'm tempted to say, lets take the alternative of making unused attributes error by default (I want that anyway) and deal with the question of syntax extensions when we stabilise those, since that won't be for a while. Otherwise, do nothing, and rely on :: in attributes for when we want to add |
@nick29581 Agreed about Okay, so I've been thinking about this a bit more, and I think this is a reasonable path forward:
Does this seem reasonable? We could push to make the grammar change and redefine all of the current compiler attributes as |
@sfackler
You mean in the future? The RfC isn't meant to be binding about |
Regardless of the merits of doing the reservation I may prefer not using the word |
Yeah, that deny-now fix-later is basically what I was thinking of when talking about the alternative (sorry I wasn't clear)
I don't think we should figure out our final attribute namespacing story in this RfC, the idea is to do something so that compiler features can be added without any backcompat hassle now, and we can decide how to namespace attributes properly in the future. There may be some unforseen reasons as to why we can't or won't support the path-based namespacing, so I consider that to be a whole different problem for when syntext stabilization comes along. Which should be in the far future, not something we should decide on now. (So it might end up that we have to use |
@brson I like this idea. |
I am well aware of the exact structure of meta items. Compiler-inspected attributes are not added all that often, and the switch from idents to paths will be straightforward. We have to live with the language decisions we make now forever. We should not be optimizing on the convenience of the small number of developers working on the compiler. I would very much prefer to not have some weird mismash of |
@sfackler Either way, the point of this RfC is not to make that decision; it is to put a safety net so that the actual attribute namespacing story can be figured out later. So in your opinion should we do nothing (it works, but we need to get paths in metaitems before doing anything) or forbid unused attributes? I personally still prefer the latter (and prefer both over |
We have to forbid unused attributes, at the very least unused attributes that start with EDIT: *we have to assuming we go with the |
I think the plan described here sounds reasonable. As far as using |
However we do it, I would like a space reserved for attributes that are internal to rustc itself. For example, there are some attributes used now for writing tests (e.g., |
83bc44b
to
ac452e4
Compare
Since there was a lot of support for just feature gating unused attributes, I've rewritten the RfC to use that as the main suggestion along the lines of @sfackler's comment. Thoughts? |
Merged. |
\o/ |
Rendered