Skip to content

Clear response values for overflow in new solver - #110614

Merged
bors merged 2 commits into
rust-lang:masterfrom
compiler-errors:new-solver-overflow-response
Apr 29, 2023
Merged

Clear response values for overflow in new solver#110614
bors merged 2 commits into
rust-lang:masterfrom
compiler-errors:new-solver-overflow-response

Conversation

@compiler-errors

@compiler-errorscompiler-errors commented Apr 20, 2023

Copy link
Copy Markdown
Contributor

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

traitTrait{}structW<T>(T);impl<T,U>TraitforW<(W<T>,W<U>)>whereW<T>:Trait,W<U>:Trait,{}fnimpls<T:Trait>(){}fnmain(){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

@rustbotrustbot 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
Copy Markdown
Collaborator

Some changes occurred to the core trait solver

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

@lcnrlcnr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

r=me after nit

Comment threadcompiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs Outdated
Comment threadcompiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs Outdated
@lcnrlcnr 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-vmsBotforce-pushed the new-solver-overflow-response branch from 645a279 to ee89421CompareApril 26, 2023 22:39
@compiler-errors

Copy link
Copy Markdown
ContributorAuthor

@bors r=lcnr

@bors

bors commented Apr 27, 2023

Copy link
Copy Markdown
Collaborator

📌 Commit ee89421 has been approved by lcnr

It is now in the queue for this repository.

@borsbors 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

bors commented Apr 28, 2023

Copy link
Copy Markdown
Collaborator

⌛ Testing commit ee89421 with merge e290b2472b9580af143784f309ef4259c4a1b9fa...

@bors

bors commented Apr 28, 2023

Copy link
Copy Markdown
Collaborator

💔 Test failed - checks-actions

@borsbors 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
Copy Markdown
Contributor

@bors retry

python setuptools issue

@borsbors removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 28, 2023
@borsbors 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
Copy Markdown
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`
@Dylan-DPCDylan-DPC mentioned this pull request Apr 29, 2023
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:masterApr 29, 2023
@rustbotrustbot 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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@compiler-errors@rustbot@bors@ehuss@rust-log-analyzer@lcnr