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

Don't ICE because recomputing overflow goals during find_best_leaf_obligation causes inference side-effects #124871

Merged
merged 1 commit into from
May 16, 2024

Conversation

compiler-errors
Copy link
Member

See the comments for more info. Reprocessing overflowed obligations may cause other goals to go from ambig -> pass/fail, causing an ICE. This suppresses that error, but makes all the overflow obligations messages back to their root obl. That kinda sucks, but 🤷

Fixes #124834
Fixes #124845

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 May 8, 2024
@rustbot
Copy link
Collaborator

rustbot commented May 8, 2024

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.

I just realized: BestObligation<'tcx>::visit_goal always returns ControlFLow::Break, doesn't it? This means that in the for nested_goals loops, we always just use the first nested ImplWhereBound of the loop 🤔 this is surprising and means the impl_where_bound_count is actually unused?

candidates.retain(|candidate| candidate.result().is_ok());
}
false => {
candidates.retain(|candidate| candidate.result().is_err());
Copy link
Contributor

Choose a reason for hiding this comment

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

this retain feels off: I would expecct us to never fail if there are any non-err candidates 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, it's probably useless.

Copy link
Contributor

Choose a reason for hiding this comment

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

pls remove it or change it to an assert then 🤔

@compiler-errors
Copy link
Member Author

this is surprising and means the impl_where_bound_count is actually unused?

Not if we have an ambig impl where bound then an err impl where bound.

@compiler-errors
Copy link
Member Author

@bors r=lcnr rollup

@bors
Copy link
Contributor

bors commented May 16, 2024

📌 Commit d3e510e 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 16, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request May 16, 2024
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#124871 (Don't ICE because recomputing overflow goals during find_best_leaf_obligation causes inference side-effects)
 - rust-lang#125018 (Update linker-plugin-lto.md to include LLVM 18)
 - rust-lang#125130 (rustdoc-json-types: Document `Id`)
 - rust-lang#125170 (Uplift `FnSig` into `rustc_type_ir` (redux))
 - rust-lang#125172 (Fix assertion when attempting to convert `f16` and `f128` with `as`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 71ae7db into rust-lang:master May 16, 2024
6 checks passed
@rustbot rustbot added this to the 1.80.0 milestone May 16, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request May 16, 2024
Rollup merge of rust-lang#124871 - compiler-errors:overflowo, r=lcnr

Don't ICE because recomputing overflow goals during find_best_leaf_obligation causes inference side-effects

See the comments for more info. Reprocessing overflowed obligations may cause *other* goals to go from ambig -> pass/fail, causing an ICE. This suppresses that error, but makes all the overflow obligations messages back to their root obl. That kinda sucks, but 🤷

Fixes rust-lang#124834
Fixes rust-lang#124845

r? lcnr
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
4 participants