-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
optimize
attribute applied to things other than methods/functions/c…
#128943
Conversation
r? @jieyouxu This needs a T-lang FCP since it diverges from the original RFC 2412 specified behavior. cc @rust-lang/lang Summary for T-langThis PR proposes to elevate The RFC explains the rationale for emitting a warn-by-default
Presumably, this was only designated as a warn-by-default In particular, the RFC and the tracking issue #54882 states an unresolved question (edited by me for correct lint name):
Other attributes such as Relevant context
@rustbot label +I-lang-nominated |
Forgot to remove the FIXME comment... |
093fe1f
to
133e486
Compare
☔ The latest upstream changes (presumably #129750) made this pull request unmergeable. Please resolve the merge conflicts. |
|
In general I prefer to give a hard error so that we can change the meaning rather than silently change behavior in the future, though sometimes practical considerations (i.e., widespread usage) make that not worth it. I doubt this attribute is heavily used however so I'm in favor of this change, assuming crater doesn't get too grouchy as a result. |
Actually, no this doesn't need a crater run. Can you rebase this, though, so it can be approved? :D |
@rustbot labels -I-lang-nominated We discussed this today in triage, and our general feeling is that conservatively giving a hard error is our preference. We talked about how, in defense of allowing these attributes liberally, that strictly speaking this is just an optimization, and so an unheeded attribute doesn't affect things in a language specification sense. But we still preferred to just give an error for now. We note that this is still unstable. This is OK to go forward as far as lang is concerned. |
I'll just jot a follow-up note here that one place where we probably do want to continue accepting (This is based on lang-team discussion here.) |
133e486
to
dd51276
Compare
@compiler-errors @nikomatsakis @pnkfelix EDIT: FWIW, I have a different open PR (#131814) for this issue in case this helps speed things up. Thank you for your patience. |
…ute, r=jieyouxu `optimize` attribute applied to things other than methods/functions/c… …losures gives an error (rust-lang#128488) Duplicate of rust-lang#128943, which I had accidentally closed when rebasing. cc. `@jieyouxu` `@compiler-errors` `@nikomatsakis` `@traviscross` `@pnkfelix.`
Rollup merge of rust-lang#131814 - Borgerr:misapplied-optimize-attribute, r=jieyouxu `optimize` attribute applied to things other than methods/functions/c… …losures gives an error (rust-lang#128488) Duplicate of rust-lang#128943, which I had accidentally closed when rebasing. cc. `@jieyouxu` `@compiler-errors` `@nikomatsakis` `@traviscross` `@pnkfelix.`
…losures gives an error (#128488)
Relevant issues:
optimize
attribute can be applied to anything #128488PR changes attribute to only apply to functions, methods, and closures by failing compilation rather than giving a warning. This relates back to this relevant comment.
This PR should absolutely be merged only after a consensus by those with say over the RFC. The purpose of the PR is to allow a simple button press for accomplishing the task.
Cc. @Centril @clubby789 @oli-obk
r? rust-lang/diagnostics