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

support revealing defined opaque post borrowck #133501

Merged
merged 3 commits into from
Nov 29, 2024

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Nov 26, 2024

By adding a new TypingMode::PostBorrowckAnalysis. Currently only supported with the new solver and I didn't look into the way we replace ReErased. @compiler-errors mentioned that always using existentials may be unsound.

Checking that opaque types are well-formed has to be able to reveal other opaque types defined by the same scope. We previously did not properly support this and instead simply allowed check_opaque_meets_bounds to define these opaques again, and then checked that the resulting constraints match the hidden types of the defining function. This results in ambiguity errors when trying to normalize such an opaque without actually defining it. See https://github.com/rust-lang/rust/blob/master/tests/ui/traits/next-solver/opaques/no-define-in-wf-check.rs for examples.

r? @compiler-errors

@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 Nov 26, 2024
@rustbot
Copy link
Collaborator

rustbot commented Nov 26, 2024

Some changes occurred to the core trait solver

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

@lcnr lcnr force-pushed the post-borrowck-analysis branch from 9e42ad1 to 3bc801d Compare November 26, 2024 15:11
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 27, 2024
[DO NOT MERGE] bootstrap with `-Znext-solver=globally`

A revival of rust-lang#124812.

Current status, we're failing in:

- failing in `rustc_next_trait_solver` with 126 instances of the following error
```
error[E0311]: the parameter type `I` may not live long enough
    |
help: consider adding an explicit lifetime bound
   --> compiler/rustc_next_trait_solver/src/solve/trait_goals.rs:624:53
    |
624 ~     fn consider_structural_builtin_unsize_candidates<'a>(
625 ~         ecx: &mut EvalCtxt<'a, D>,
626 |         goal: Goal<I, Self>,
627 ~     ) -> Vec<Candidate<I>> where I: 'a {
```
- `itertools` hangs, we're already encountered this hang in our previous attempt due to large type sizes. I believe that it's simply caused by a missing cache somewhere, potentially in `wf.rs`, but other visitors may also be responsible. See rust-itertools/itertools#945 for more details

### commits

- rust-lang#133501
- rust-lang#133493
- 9456bfe and b21b116 reimplement candidate preference based on rust-lang#132325, not yet a separate PR
- c3ef9cd is a rebased version of rust-lang#125334, unsure whether I actually want to land this PR for now

r? `@ghost`
Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally happy w/ the approach. I like how small the diff is given the typing mode refactor :D

Could you try to uplift fold_regions? It feels bad to have that not be a folder defined in type_ir since it's really pretty simple otherwise.

compiler/rustc_type_ir/src/interner.rs Outdated Show resolved Hide resolved
compiler/rustc_trait_selection/src/traits/normalize.rs Outdated Show resolved Hide resolved
@lcnr lcnr force-pushed the post-borrowck-analysis branch from 3bc801d to a35cda9 Compare November 27, 2024 17:37
@rustbot
Copy link
Collaborator

rustbot commented Nov 27, 2024

HIR ty lowering was modified

cc @fmease

@lcnr lcnr force-pushed the post-borrowck-analysis branch from a35cda9 to 299b742 Compare November 27, 2024 17:42
@lcnr
Copy link
Contributor Author

lcnr commented Nov 27, 2024

rdy

bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 27, 2024
[DO NOT MERGE] bootstrap with `-Znext-solver=globally`

A revival of rust-lang#124812.

Current status:

`./x.py b --stage 2` passes 🎉

### commits

- rust-lang#133501
- rust-lang#133493
- 9456bfe and b21b116 reimplement candidate preference based on rust-lang#132325, not yet a separate PR
- c3ef9cd is a rebased version of rust-lang#125334, unsure whether I actually want to land this PR for now
- rust-lang#133517
* rust-lang#133518
* rust-lang#133519
* rust-lang#133520
* rust-lang#133521
* rust-lang#133524

r? `@ghost`
@rust-log-analyzer

This comment has been minimized.

bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 27, 2024
[DO NOT MERGE] bootstrap with `-Znext-solver=globally`

A revival of rust-lang#124812.

Current status:

`./x.py b --stage 2` passes 🎉

### commits

- rust-lang#133501
- rust-lang#133493
- 9456bfe and b21b116 reimplement candidate preference based on rust-lang#132325, not yet a separate PR
- c3ef9cd is a rebased version of rust-lang#125334, unsure whether I actually want to land this PR for now
- rust-lang#133517
* rust-lang#133518
* rust-lang#133519
* rust-lang#133520
* rust-lang#133521
* rust-lang#133524

r? `@ghost`
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 28, 2024
[DO NOT MERGE] bootstrap with `-Znext-solver=globally`

A revival of rust-lang#124812.

Current status:

`./x.py b --stage 2` passes 🎉

### commits

- rust-lang#133501
- rust-lang#133493
- 9456bfe and b21b116 reimplement candidate preference based on rust-lang#132325, not yet a separate PR
- c3ef9cd is a rebased version of rust-lang#125334, unsure whether I actually want to land this PR for now
- rust-lang#133517
* rust-lang#133518
* rust-lang#133519
* rust-lang#133520
* rust-lang#133521
* rust-lang#133524

r? `@ghost`
@lcnr lcnr force-pushed the post-borrowck-analysis branch from 299b742 to 34a8c2d Compare November 28, 2024 09:41
@lcnr
Copy link
Contributor Author

lcnr commented Nov 28, 2024

actually rdy xd

@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Nov 28, 2024

📌 Commit 34a8c2d has been approved by compiler-errors

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 Nov 28, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 29, 2024
…piler-errors

support revealing defined opaque post borrowck

By adding a new `TypingMode::PostBorrowckAnalysis`. Currently only supported with the new solver and I didn't look into the way we replace `ReErased`. `@compiler-errors` mentioned that always using existentials may be unsound.

r? `@compiler-errors`
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 29, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#132782 (improvements on initial sysroot and libdir finding logics)
 - rust-lang#133134 (Don't use a SyntheticProvider for literally every type)
 - rust-lang#133466 (Fix typos in pin.rs)
 - rust-lang#133492 (bootstrap: allow skipping steps with start of path)
 - rust-lang#133501 (support revealing defined opaque post borrowck)
 - rust-lang#133530 (Use consistent wording in docs, use is zero instead of is 0)
 - rust-lang#133538 (Better diagnostic for fn items in variadic functions)
 - rust-lang#133590 (Rename `-Zparse-only`)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 29, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#132782 (improvements on initial sysroot and libdir finding logics)
 - rust-lang#133466 (Fix typos in pin.rs)
 - rust-lang#133492 (bootstrap: allow skipping steps with start of path)
 - rust-lang#133501 (support revealing defined opaque post borrowck)
 - rust-lang#133530 (Use consistent wording in docs, use is zero instead of is 0)
 - rust-lang#133538 (Better diagnostic for fn items in variadic functions)
 - rust-lang#133590 (Rename `-Zparse-only`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 6863327 into rust-lang:master Nov 29, 2024
6 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Nov 29, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 29, 2024
Rollup merge of rust-lang#133501 - lcnr:post-borrowck-analysis, r=compiler-errors

support revealing defined opaque post borrowck

By adding a new `TypingMode::PostBorrowckAnalysis`. Currently only supported with the new solver and I didn't look into the way we replace `ReErased`. ``@compiler-errors`` mentioned that always using existentials may be unsound.

r? ``@compiler-errors``
@lcnr lcnr deleted the post-borrowck-analysis branch December 5, 2024 09:56
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