-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Do not apply #[do_not_recommend]
if the feature flag is not set
#128674
Do not apply #[do_not_recommend]
if the feature flag is not set
#128674
Conversation
This comment has been minimized.
This comment has been minimized.
Hm.. This current approach has the consequence of disabling the attribute even when it's applied to upstream crates that can use the feature, like libcore.. We may need to store this info somewhere in the impl itself 🤔 |
Or actually, let's not worry about that. @weiznich, can you split |
There are two other alternatives that might be possible:
|
I don't see how this fixes anything? Can you explain? Specifically, I don't want to regress the error messages of stable code that uses the
This seems like a weird way to fix this regression. We almost certainly need to experiment with |
You are right that doesn't fix the problem :( |
Because then you can continue gating usages of |
@rustbot author |
☔ The latest upstream changes (presumably #128761) made this pull request unmergeable. Please resolve the merge conflicts. |
Thanks for clarifying. That sounds like it would work on a technical level, although I very much would prefer not to do this as I fear that it makes it harder to stabilize this feature as usages in the standard library might then be counted as active usages of the corresponding unstable feature as it strictly uses different code. That written: I'm not sure if I find the capacity to implement a different solution (or even that renaming) sometime soon. Edit: Turns out it wasn't that hard to track the relevant information as part of the attribute, although I'm not user if I put everything in the right place. |
This commit adds additional checks for the feature flag as apparently it is possible to use this on a beta compiler without feature flags. To track whether a diagnostic attribute is allowed based of the feature in certain possibly upstream crate we introduce a new boolean flag stored in each attribute. This hopefully enables future diagnostic attributes to prevent this situation, as there is now a single place that can be checked whether the attribute should be honored or not. This0PR might be a candidate for backporting to the latest beta release. Reported in the bevy issue tracker: bevyengine/bevy#14591 (comment)
b36d15e
to
f518ce8
Compare
I don't agree with this concern. This was not a concern when stabilizing I'm not too comfortable with this approach, and I wouldn't want to beta backport it either. T-compiler has a "revert first" approach when it comes to regressions though. Until we can settle on a design, could you just please disable |
@bors try @rust-timer queue -- Just gauging the impact of this approach anyways. |
This comment has been minimized.
This comment has been minimized.
…d_feature, r=<try> Do not apply `#[do_not_recommend]` if the feature flag is not set This commit adds additional checks for the feature flag as apparently it is possible to use this on a beta compiler without feature flags. This PR might be a candidate for backporting. Reported in the bevy issue tracker: bevyengine/bevy#14591 (comment) r? `@compiler-errors`
Well -- I guess I'm second guessing myself whether this even warrants a beta revert or not. This only affects the error path, and given that this doesn't affect the successful compilation of code, I'm actually not certain this warrants either a fix or a revert (especially since an erroneous |
…l, r=<try> Store `do_not_recommend`-ness in impl header Alternative to rust-lang#128674 It's less flexible, but also less invasive. Hopefully it's also performant. I'd recommend we think separately about the design for how to gate arbitrary diagnostic attributes moving forward.
#128912 is an alternative that encodes I understand that it's less flexible than a general mechanism to gate arbitrary diagnostic attributes, but it's also less invasive than having to encode the gatedness of diagnostic attrs all the way down into the AST. Ideally we could spend some time thinking of the best representation for gating arbitrary diagnostic attributes separately from fixing this specific issue. |
…l, r=<try> Store `do_not_recommend`-ness in impl header Alternative to rust-lang#128674 It's less flexible, but also less invasive. Hopefully it's also performant. I'd recommend we think separately about the design for how to gate arbitrary diagnostic attributes moving forward.
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (ce5a56a): comparison URL. Overall result: ❌ regressions - ACTION NEEDEDBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)Results (primary 2.4%, secondary 1.9%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (primary -0.9%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeResults (primary 0.1%, secondary 0.0%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Bootstrap: 760.743s -> 762.86s (0.28%) |
The last version of this PR already did this. I can push that version again as new PR tomorrow or on Monday. I just read you previous comments in such a way that you don't want to do that as it would regress the one error from rusts standard library that already uses the As for the performance numbers: My feeling is that the expensive part here is the additional pass over the AST of the whole crate as done by the new visitor. We should be able to easily sidestep that by just adding the relevant logic to one of the existing visitors, right? And yes, the underlying problem of how to gate new diagnostic attributes is something that might be worth to discuss unrelated from this "bugfix". I personally would rather go for a general solution as otherwise we might run into this again and again for any future new attribute. |
I'm not certain. This may also come from making the attribute struct larger 🤷 |
…mpl, r=lcnr Store `do_not_recommend`-ness in impl header Alternative to rust-lang#128674 It's less flexible, but also less invasive. Hopefully it's also performant. I'd recommend we think separately about the design for how to gate arbitrary diagnostic attributes moving forward.
Given that the size of the struct did not change according to some quick checks via |
Also: Given that your other PR is already accepted is there even interest in fixing that or having a backport PR? If that's not the case I rather would prefer not to spend anymore time. |
…mpl, r=lcnr Store `do_not_recommend`-ness in impl header Alternative to rust-lang#128674 It's less flexible, but also less invasive. Hopefully it's also performant. I'd recommend we think separately about the design for how to gate arbitrary diagnostic attributes moving forward.
…mpl, r=lcnr Store `do_not_recommend`-ness in impl header Alternative to rust-lang#128674 It's less flexible, but also less invasive. Hopefully it's also performant. I'd recommend we think separately about the design for how to gate arbitrary diagnostic attributes moving forward.
…mpl, r=lcnr Store `do_not_recommend`-ness in impl header Alternative to rust-lang#128674 It's less flexible, but also less invasive. Hopefully it's also performant. I'd recommend we think separately about the design for how to gate arbitrary diagnostic attributes moving forward.
Actually, most of the changed perf tests are Yeah, let's not work any more on this PR; though if you want to discuss how to make sure this doesn't happen, feel free to reach out on zulip and we can brainstorm. I'll backport nominate #128912, but I'll also mention to the compiler team about the alternative of doing nothing, or reverting all of the |
Rollup merge of rust-lang#128912 - compiler-errors:do-not-recommend-impl, r=lcnr Store `do_not_recommend`-ness in impl header Alternative to rust-lang#128674 It's less flexible, but also less invasive. Hopefully it's also performant. I'd recommend we think separately about the design for how to gate arbitrary diagnostic attributes moving forward.
This commit adds additional checks for the feature flag as apparently it is possible to use this on a beta compiler without feature flags. This PR might be a candidate for backporting.
Reported in the bevy issue tracker: bevyengine/bevy#14591 (comment)
r? @compiler-errors