-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Add support for inherent projections in new solver #113336
Conversation
Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor |
tcx.type_of(impl_def_id).subst(tcx, impl_substs), | ||
)?; | ||
self.add_goals( | ||
tcx.predicates_of(impl_def_id) |
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.
Here, just like the normal projection code,
rust/compiler/rustc_trait_selection/src/solve/trait_goals.rs
Lines 70 to 76 in 4dbc7e3
let where_clause_bounds = tcx | |
.predicates_of(impl_def_id) | |
.instantiate(tcx, impl_substs) | |
.predicates | |
.into_iter() | |
.map(|pred| goal.with(tcx, pred)); | |
ecx.add_goals(where_clause_bounds); |
Not exactly sure if we should be registering both. Maybe it affects inference?? 🤷
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.
please also check GAT where clauses for this, ordinary trait impl candidates and object candidates, and weak alias types rust-lang/trait-system-refactor-initiative#44
5c4170f
to
57de776
Compare
@@ -122,6 +123,14 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> { | |||
)?; | |||
ecx.eq(goal.param_env, goal.predicate.term, assumption_projection_pred.term) | |||
.expect("expected goal term to be fully unconstrained"); | |||
|
|||
// Add GAT where clauses from the trait's definition |
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.
I found it easier to check the GAT WC here in probe_and_match_goal_against_assumption
rather than just doing it for object candidates. This also makes sure we check them correctly for alias bounds, and for most other built-in bounds which end up flowing through this method.
Let me know what you think about this.
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.
hm... I don't feel too happy about this but don't really know. It feels potentially unnecessary and might cause issues. But I guess we cna always move it out and check it in less places.
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.
I mean, especially moving towards coinduction, I'm not certain if I understand how this isn't going to be necessary. Builtin candidates should be checking their GAT WCs for them to be sound, right?
☔ The latest upstream changes (presumably #113637) made this pull request unmergeable. Please resolve the merge conflicts. |
r=me after rebase |
57de776
to
7c3d5ff
Compare
@bors r=lcnr |
📌 Commit 7c3d5fffbb844c9ec34e4e55d9af02fc53c0cfb3 has been approved by It is now in the queue for this repository. |
☔ The latest upstream changes (presumably #113591) made this pull request unmergeable. Please resolve the merge conflicts. |
🔒 Merge conflict This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again. How do I rebase?Assuming
You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial. Please avoid the "Resolve conflicts" button on GitHub. It uses Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Error message
|
7c3d5ff
to
c9ce51b
Compare
rebased to rename substs to args @bors r=lcnr |
☀️ Test successful - checks-actions |
Finished benchmarking commit (4c7af42): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression 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)ResultsThis 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 sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 657.855s -> 656.194s (-0.25%) |
Not hard to support these, and it cuts out a really big chunk of failing UI tests with
--compare-mode=next-solver
r? @lcnr (feel free to reassign, anyone can review this)