-
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
Normalize obligation and expected trait_refs in confirm_poly_trait_refs #94108
Normalize obligation and expected trait_refs in confirm_poly_trait_refs #94108
Conversation
This comment has been minimized.
This comment has been minimized.
056c3c5
to
3b1717e
Compare
Forgot to remove a deleted test stderr.. |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 3b1717eea1995cb31c0bca26cc734354930a93b3 with merge 8bd972219e2ab01d74589bbc494630993b93c5a2... |
☀️ Try build successful - checks-actions |
Queued 8bd972219e2ab01d74589bbc494630993b93c5a2 with parent 30b3f35, future comparison URL. |
Finished benchmarking commit (8bd972219e2ab01d74589bbc494630993b93c5a2): comparison url. Summary: This benchmark run shows 1 relevant improvement 🎉 to instruction counts.
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 |
Interesting to see that this alone doesn't really improve perf other than one case, but when paired with the other fulfillment normalization PRs, it causes many cases to no longer regress like 1%. |
I think we can land this separately, but I need to review later. |
Cool, I will make it not a draft and give it a real title and description, then. |
r? @jackh726 (just for tracking purposes, no rush on the review) |
@@ -2,18 +2,18 @@ error[E0631]: type mismatch in function arguments | |||
--> $DIR/issue-88382.rs:27:40 | |||
| | |||
LL | do_something(SomeImplementation(), test); | |||
| ------------ ^^^^ expected signature of `for<'a> fn(&mut <SomeImplementation as Iterable>::Iterator<'a>) -> _` | |||
| ------------ ^^^^ expected signature of `for<'r> fn(&'r mut std::iter::Empty<usize>) -> _` |
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.
This test highlights that something wonky is going on. It changes were we aren't able to normalize.
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.
Yeah, this is very interesting. Possibly due to changes in the ordering of resolving the inference variable in &mut <_ as Iterable>::Iterator<'a>
and normalizing it. Now that we're eagerly normalizing the trait ref, we probably are substituting that value before we have a chance to unify the argument type with something else, possibly another projection type with an inference variable.
@bors r+ |
📌 Commit 3b1717eea1995cb31c0bca26cc734354930a93b3 has been approved by |
☔ The latest upstream changes (presumably #94134) made this pull request unmergeable. Please resolve the merge conflicts. |
@bors delegate+ |
✌️ @compiler-errors can now approve this pull request |
3b1717e
to
b59c958
Compare
@bors r=jackh726 |
📌 Commit b59c958 has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (a924ef7): 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. @rustbot label: -perf-regression |
Just FYI: this likely changed inference to (correctly) accept more cases: https://www.reddit.com/r/rust/comments/t8ifzy/type_inference_fails_on_stable_but_succeeds_on/?utm_medium=android_app&utm_source=share |
Consolidate normalization the obligation and expected trait refs in
confirm_poly_trait_refs
. Also, always normalize these trait refs -- we were already normalizing the obligation trait ref when confirming closure and generator candidates, but this does it for fn pointer confirmation as well.This presumably does more work in the case that the obligation's trait ref is already normalized, but we can see from the perf runs in #94070, it actually (paradoxically, perhaps) improves performance when paired with logic that normalizes projections in fulfillment loop.