Skip to content
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

Merged
merged 2 commits into from
May 10, 2023

Conversation

compiler-errors
Copy link
Member

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 if T: 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 the Bound 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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Apr 22, 2023
@rustbot
Copy link
Collaborator

rustbot commented Apr 22, 2023

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

@bors
Copy link
Contributor

bors commented Apr 22, 2023

☔ The latest upstream changes (presumably #110674) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

bors commented Apr 25, 2023

☔ The latest upstream changes (presumably #110821) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Contributor

@lcnr lcnr left a 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

@rust-cloud-vms rust-cloud-vms bot force-pushed the alias-bounds-2 branch 2 times, most recently from 2bfcf93 to 59c0fcc Compare May 9, 2023 18:37
@rust-log-analyzer

This comment has been minimized.

@compiler-errors
Copy link
Member Author

@bors r=lcnr rollup (only affects new solver)

@bors
Copy link
Contributor

bors commented May 10, 2023

📌 Commit 3a863e5 has been approved by lcnr

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 10, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request May 10, 2023
…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
@bors bors merged commit c14d912 into rust-lang:master May 10, 2023
@rustbot rustbot added this to the 1.71.0 milestone May 10, 2023
@compiler-errors compiler-errors deleted the alias-bounds-2 branch August 11, 2023 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants