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

Clear response values for overflow in new solver #110614

Merged
merged 2 commits into from
Apr 29, 2023

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Apr 20, 2023

When we have an overflow, return a trivial query response. This fixes an ICE with the code described in #110544:

trait Trait {}

struct W<T>(T);

impl<T, U> Trait for W<(W<T>, W<U>)>
where
    W<T>: Trait,
    W<U>: Trait,
{}

fn impls<T: Trait>() {}

fn main() {
    impls::<W<_>>()
}

Where, while proving W<?0>: Trait, we overflow but still apply the query response of ?0 = (W<?1>, W<?2>). Then while re-processing the query to validate that our evaluation result was stable, we get a different query response that looks like ?1 = (W<?3>, W<?4>), ?2 = (W<?5>, W<?6>), and so we trigger the ICE.

Also, by returning a trivial query response we also avoid the infinite-loop/OOM behavior of the old solver.

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

rustbot commented Apr 20, 2023

Some changes occurred to the core trait solver

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

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.

r=me after nit

@lcnr lcnr added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 26, 2023
@rust-cloud-vms rust-cloud-vms bot force-pushed the new-solver-overflow-response branch from 645a279 to ee89421 Compare April 26, 2023 22:39
@compiler-errors
Copy link
Member Author

@bors r=lcnr

@bors
Copy link
Contributor

bors commented Apr 27, 2023

📌 Commit ee89421 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 27, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Apr 27, 2023
…w-response, r=lcnr

Clear response values for overflow in new solver

When we have an overflow, return a trivial query response. This fixes an ICE with the code described in rust-lang#110544:

```rust
trait Trait {}

struct W<T>(T);

impl<T, U> Trait for W<(W<T>, W<U>)>
where
    W<T>: Trait,
    W<U>: Trait,
{}

fn impls<T: Trait>() {}

fn main() {
    impls::<W<_>>()
}
```

Where, while proving `W<?0>: Trait`, we overflow but still apply the query response of `?0 = (W<?1>, W<?2>)`. Then while re-processing the query to validate that our evaluation result was stable, we get a different query response that looks like `?1 = (W<?3>, W<?4>), ?2 = (W<?5>, W<?6>)`, and so we trigger the ICE.

Also, by returning a trivial query response we also avoid the infinite-loop/OOM behavior of the old solver.

r? `@lcnr`
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Apr 28, 2023
…w-response, r=lcnr

Clear response values for overflow in new solver

When we have an overflow, return a trivial query response. This fixes an ICE with the code described in rust-lang#110544:

```rust
trait Trait {}

struct W<T>(T);

impl<T, U> Trait for W<(W<T>, W<U>)>
where
    W<T>: Trait,
    W<U>: Trait,
{}

fn impls<T: Trait>() {}

fn main() {
    impls::<W<_>>()
}
```

Where, while proving `W<?0>: Trait`, we overflow but still apply the query response of `?0 = (W<?1>, W<?2>)`. Then while re-processing the query to validate that our evaluation result was stable, we get a different query response that looks like `?1 = (W<?3>, W<?4>), ?2 = (W<?5>, W<?6>)`, and so we trigger the ICE.

Also, by returning a trivial query response we also avoid the infinite-loop/OOM behavior of the old solver.

r? ``@lcnr``
@bors
Copy link
Contributor

bors commented Apr 28, 2023

⌛ Testing commit ee89421 with merge e290b2472b9580af143784f309ef4259c4a1b9fa...

@bors
Copy link
Contributor

bors commented Apr 28, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 28, 2023
@ehuss
Copy link
Contributor

ehuss commented Apr 28, 2023

@bors retry

python setuptools issue

@bors bors removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 28, 2023
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Apr 28, 2023
@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Apr 29, 2023
…w-response, r=lcnr

Clear response values for overflow in new solver

When we have an overflow, return a trivial query response. This fixes an ICE with the code described in rust-lang#110544:

```rust
trait Trait {}

struct W<T>(T);

impl<T, U> Trait for W<(W<T>, W<U>)>
where
    W<T>: Trait,
    W<U>: Trait,
{}

fn impls<T: Trait>() {}

fn main() {
    impls::<W<_>>()
}
```

Where, while proving `W<?0>: Trait`, we overflow but still apply the query response of `?0 = (W<?1>, W<?2>)`. Then while re-processing the query to validate that our evaluation result was stable, we get a different query response that looks like `?1 = (W<?3>, W<?4>), ?2 = (W<?5>, W<?6>)`, and so we trigger the ICE.

Also, by returning a trivial query response we also avoid the infinite-loop/OOM behavior of the old solver.

r? `@lcnr`
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 29, 2023
Rollup of 6 pull requests

Successful merges:

 - rust-lang#110614 (Clear response values for overflow in new solver)
 - rust-lang#110894 (Bump libffi-sys to 2.3.0)
 - rust-lang#110932 (include source error for LoadLibraryExW)
 - rust-lang#110958 (Make sure that some stdlib method signatures aren't accidental refinements)
 - rust-lang#110962 (Make drop_flags an IndexVec.)
 - rust-lang#110965 (Don't duplicate anonymous lifetimes for async fn in traits)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 6da62a4 into rust-lang:master Apr 29, 2023
@rustbot rustbot added this to the 1.71.0 milestone Apr 29, 2023
@compiler-errors compiler-errors deleted the new-solver-overflow-response branch August 11, 2023 20:09
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.

6 participants