-
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
Make alias bounds sound in the new solver (take 2) #110673
Conversation
Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor |
☔ The latest upstream changes (presumably #110674) made this pull request unmergeable. Please resolve the merge conflicts. |
8152fc9
to
25d8860
Compare
☔ The latest upstream changes (presumably #110821) made this pull request unmergeable. Please resolve the merge conflicts. |
25d8860
to
c0bf6ad
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.
nits, then r=me. I am not completely happy with having default methods on GoalKind
but whatever, not sure whether having these on EvalCtxt
is cleaner or not
2bfcf93
to
59c0fcc
Compare
This comment has been minimized.
This comment has been minimized.
59c0fcc
to
3a863e5
Compare
@bors r=lcnr rollup (only affects new solver) |
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#110673 (Make alias bounds sound in the new solver (take 2)) - rust-lang#110747 (Encode types in SMIR) - rust-lang#111095 (Correctly handle associated items of a trait inside a `#[doc(hidden)]` item) - rust-lang#111381 (Keep encoding attributes for closures) - rust-lang#111408 (Fix incorrect implication of transmuting slices) - rust-lang#111410 (Switch to `EarlyBinder` for `thir_abstract_const` query) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Make alias bounds sound in the new solver (in a way that does not require coinduction) by only considering them for projection types whose corresponding trait refs come from a param-env candidate.
That is, given
<T as Trait>::Assoc: Bound
, we only really need to consider the alias bound ifT: Trait
is satisfied via a param-env candidate. If it's instead satisfied, e.g., via an user provided impl candidate or a , then that impl should have a concrete type to which we could otherwise normalize<T as Trait>::Assoc
, and that concrete type is then responsible to prove theBound
on it.Similar consideration is given to opaque types, since we only need to consider alias bounds if we're not in reveal-all mode, since similarly we'd be able to reveal the opaque types and prove any bounds that way.
This does not remove that hacky "eager projection replacement" logic from object bounds, which are somewhat like alias bounds. But removing this eager normalization behavior (added in #108333) would require full coinduction to be enabled. Compare to #110628, which does remove this object-bound custom logic but requires coinduction to be sound.
r? @lcnr