-
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
Erase trivial caller-bounds when typechecking MIR after optimizations #94238
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
r? @nikomatsakis since this has to do with how we normalize projection types, but feel free to send this to someone else |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 240e56189205b2a30bd84601cbcbede36b33812b with merge 689f51a2c72ad2d2c5eb3719fa78e8e209214e64... |
This comment has been minimized.
This comment has been minimized.
💔 Test failed - checks-actions |
lol let me fix that |
240e561
to
244a73c
Compare
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 244a73c with merge dc5b9515ae3599b4dc5438f23aee3092e95c2543... |
☀️ Try build successful - checks-actions |
Queued dc5b9515ae3599b4dc5438f23aee3092e95c2543 with parent 3d127e2, future comparison URL. |
Finished benchmarking commit (dc5b9515ae3599b4dc5438f23aee3092e95c2543): comparison url. Summary: This benchmark run did not return any relevant results. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking 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 led to changes in compiler perf. @bors rollup=never |
@rustbot label -S-waiting-on-author |
could we flip this in reveal_all mode? |
I could try that, shouldn't be too hard. |
Hmm, this seems like a good thing to talk over, @compiler-errors. If it works for you, maybe schedule something at https://calendly.com/nikomatsakis/ ? |
So after discussing with @nikomatsakis, this PR is probably not the right way to go through with this. We discussed a few other options, which I'll likely test out and maybe put up for review. I'll mark this one as experimental. @rustbot -S-waiting-on-review +S-experimental |
lol whoops @rustbot label -S-waiting-on-review +S-experimental |
This is probably(?) fixed by @cjgillot's finished mir-inliner PR. I will add a test later anyways. |
Fixes an ICE when inlining this code (with
-Zmir-opt-level=3
):Specifically, inside of
bar
, we normalize<IntFactory as Factory<T>>::Item
tousize
, but we cannot do the same inside offoo
, because param-env candidates have precedence over impl candidates when satisfying the projection. This usually isn't a problem, but becomes one when we inlinebar
intobaz
and cannot unifyusize
with<IntFactory as Factory<T>>::Item
.This attempts to solve the issue by filtering thru the ParamEnv and removing any predicates that are "trivial" -- that is, that are satisfied by the ParamEnv when the bound is removed from the ParamEnv's caller bounds. This ensures that we never allow a trivial
<Ty as Trait>
predicate in the ParamEnv interfere with projection normalization during codegen.cc: #91743 (comment)
cc: @cjgillot since it helps a get rid of a few (but not all) ICEs seen from nalgebra-v0.21.1 in #91743
NOTE: this is kinda a hack, a super heavy hammer that I'm not sure if we should implement in the first place. I'm open to closing this piece of garbage out for a better brainstorming session for how to handle ambiguities as noted above. 😄