-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Defer evaluating type system constants when they use infers or params #140553
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
Conversation
This PR changes a file inside |
This comment has been minimized.
This comment has been minimized.
e276dd1
to
42f9d9a
Compare
This comment has been minimized.
This comment has been minimized.
42f9d9a
to
de3acb8
Compare
☔ The latest upstream changes (presumably #140561) made this pull request unmergeable. Please resolve the merge conflicts. |
de3acb8
to
2784c3c
Compare
2784c3c
to
bb7e27a
Compare
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.
:>
cool @bors r+ rollup=never |
@bors r- :<
is true. at the very least I want to make sure I understand why this doesnt break anything.. because I would probably expect it to |
fn unevaluated_to_pat(
...
// try to resolve e.g. associated constants to their definition on an impl, and then
// evaluate the const.
let valtree = match self.tcx.const_eval_resolve_for_typeck(typing_env, uv, self.span) { We don't invoke type system norm on these constants though we just directly call into const eval resolve so this is fine. I.e. we won't break the following code: trait Trait { const ASSOC: usize; }
impl<T> Trait for T {
const ASSOC: usize = 10;
}
fn bar<T>(a: usize) {
match a {
<T as Trait>::ASSOC => (),
_ => (),
}
} Where we try to evaluate |
bb7e27a
to
4f2e93a
Compare
I think |
4f2e93a
to
fdccb42
Compare
Added a test anyway because it seems nice to have one specifically for this case instead of only having a test that happens to fail but was meant for something else. @rustbot ready (I checked locally what tests fail if I change us to use type system norm to evaluate patterns and also confirmed that the test I added fails if we do that) |
@bors r+ |
☀️ Test successful - checks-actions |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing e7f4317 (parent) -> 52bf0cf (this PR) Test differencesShow 16 test diffsStage 1
Stage 2
Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 52bf0cf795dfecc8b929ebb1c1e2545c3f41d4c9 --output-dir test-dashboard And then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
Finished benchmarking commit (52bf0cf): comparison URL. Overall result: ❌ regressions - please read the text belowOur benchmarks found a performance regression caused by this PR. Next Steps:
@rustbot label: +perf-regression Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary 0.2%, secondary 4.2%)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.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeResults (primary 0.4%, secondary 0.4%)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: 778.581s -> 777.568s (-0.13%) |
The binary size regressions correspond to metadata getting larger, not actual binary size increases. |
…mpiler-errors Defer evaluating type system constants when they use infers or params Split out of rust-lang#137972, the parts necessary for associated const equality and min generic const args to make progress and have correct semantics around when CTFE is invoked. According to a [previous perf run](https://perf.rust-lang.org/compare.html?start=93257e2d20809d82d1bc0fcc1942480d1a66d7cd&end=01b4cbf0f47c3f782330db88fa5ba199bba1f8a2&stat=instructions:u) of adding the new `const_arg_kind` query we should expect minor regressions here. I think this is acceptable as we should be able to remove this query relatively soon once mgca is more complete as we'll then be able to implement GCE in terms of mgca and rip out `GCEConst` at which point it's trivial to determine what kind of anon const we're dealing with (either it has generics and is a repeat expr hack, or it doesnt and is a normal anon const). This should only affect unstable code as we handle repeat exprs specially and those are the only kinds of type system consts that are allowed to make use of generic parameters. Fixes rust-lang#133066 Fixes rust-lang#133199 Fixes rust-lang#136894 Fixes rust-lang#137813 r? compiler-errors
@BoxyUwU @compiler-errors looking at some of the regressions in detail it does look like we're spending more time in I see that perf regressions were expected. Are we fine with the magnitude seen here? |
Yeah, this is a consequence of encoding a new query into metadata. I believe that this perf regression is okay. |
Split out of #137972, the parts necessary for associated const equality and min generic const args to make progress and have correct semantics around when CTFE is invoked. According to a previous perf run of adding the new
const_arg_kind
query we should expect minor regressions here.I think this is acceptable as we should be able to remove this query relatively soon once mgca is more complete as we'll then be able to implement GCE in terms of mgca and rip out
GCEConst
at which point it's trivial to determine what kind of anon const we're dealing with (either it has generics and is a repeat expr hack, or it doesnt and is a normal anon const).This should only affect unstable code as we handle repeat exprs specially and those are the only kinds of type system consts that are allowed to make use of generic parameters.
Fixes #133066
Fixes #133199
Fixes #136894
Fixes #137813
r? compiler-errors