-
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
Implement proper stability check for const impl Trait, fall back to unstable const when undeclared #97177
Conversation
This avoids an ambiguity (when reading) where `.level.is_stable()` is not immediately clear whether it is general stability or const stability.
Rather than deferring to const eval for checking if a trait is const, we now check up-front. This allows the error to be emitted earlier, notably at the same time as other stability checks. Also included in this commit is a change of the default const stability level to UNstable. Previously, an item that was `const` but did not explicitly state it was unstable was implicitly stable.
This alters the diagnostics a bit, as the trait method is still stable. The only thing this check does is ensure that compilation fails if a trait implementation is declared const-stable.
Some changes occurred in cc @camelid |
r? @davidtwco (rust-highfive has picked a reviewer for you, use r? to override) |
Well, that's good to know at least! It's been a little bit since I've looked at this change, but I'll look over your additions soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me unless jhpratt has feedback
LGTM. @bors r=davidtwco |
@jhpratt: 🔑 Insufficient privileges: Not in reviewers |
@bors r+ |
📌 Commit f9c4f2b has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (acfd327): comparison url. Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results
CyclesThis benchmark run did not return any relevant results for this metric. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression Footnotes |
Continuation of #93960
@jhpratt it looks to me like the test was simply not testing for the failure you were looking for? Your checks actually do the right thing for const traits?