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 the provisional cache slightly less broken #114694

Merged
merged 2 commits into from
Aug 11, 2023

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Aug 10, 2023

It is still broken for the following cycles:

graph LR
   R["R: coinductive"] --> A["A: inductive"]
   R --> B["B: coinductive"]
   A --> B
   B --> R
Loading

the R -> A -> B -> R cycle should be considered to not hold, as it is mixed, but because we first put B into the cache from the R -> B -> R cycle which is coinductive, it does hold.

This issue will also affect our new coinduction approach. Longterm cycles are coinductive as long as one step goes through an impl where-clause, see https://github.com/rust-lang/a-mir-formality/blob/f4fc5bae36ab1a9fefddd54e5ccffc5f671467ec/crates/formality-prove/src/prove/prove_wc.rs#L51-L62. Here we would first have a fully inductive cycle R -> B -> R which is then entered by a cycle with a coinductive step R -> A -coinductive-> B -> R.

I don't know how to soundly implement a provisional cache for goals not on the stack without tracking all cycles the goal was involved in and whether they were inductive or not. We could then only use goals from the cache if the inductivity? of every cycle remained the same. This is a mess to implement. I therefore want to rip out the provisional cache entirely, but will wait with this until I talked about it with @nikomatsakis.

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 Aug 10, 2023
@rustbot
Copy link
Collaborator

rustbot commented Aug 10, 2023

Some changes occurred to the core trait solver

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

@@ -39,7 +39,7 @@ fn impls_ar<T: AR>() {}

fn main() {
impls_a::<()>();
//~^ ERROR overflow evaluating the requirement `(): A`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the issue I am talking about in the PR description

@rust-log-analyzer

This comment has been minimized.

@lcnr lcnr force-pushed the provisional-cache branch 3 times, most recently from e4af0a0 to b5346a0 Compare August 10, 2023 12:17
@compiler-errors
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Aug 10, 2023

📌 Commit 02529d2 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 Aug 10, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 11, 2023
…mpiler-errors

Rollup of 7 pull requests

Successful merges:

 - rust-lang#114599 (Add impl trait declarations to SMIR)
 - rust-lang#114622 (rustc: Move `crate_types` and `stable_crate_id` from `Session` to `GlobalCtxt`)
 - rust-lang#114662 (Unlock trailing where-clauses for lazy type aliases)
 - rust-lang#114693 (Remove myself from the review rotation)
 - rust-lang#114694 (make the provisional cache slightly less broken)
 - rust-lang#114705 (Add spastorino to mailmap)
 - rust-lang#114712 (Fix a couple of bad comments)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit a04dfc3 into rust-lang:master Aug 11, 2023
@rustbot rustbot added this to the 1.73.0 milestone Aug 11, 2023
@lcnr lcnr deleted the provisional-cache branch August 11, 2023 07:20
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