Skip to content

Conversation

@adwinwhite
Copy link
Contributor

@adwinwhite adwinwhite commented Nov 25, 2025

Fixes the ICE variant in rust-lang/trait-system-refactor-initiative#245.
Fixes #142866.

The detailed cause is in the test comments.

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 Nov 25, 2025
@rust-log-analyzer

This comment has been minimized.

try_borrowing(cause.derived.parent_trait_pred, &[])
// Parent trait predicate may contain regions that's already popped since `cause`
// in `Obligation` is ignored by folders/visitors.
// We can erase them since evaluation later doesn't care about regions anyway.
Copy link
Contributor

Choose a reason for hiding this comment

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

is that because the BestObligation folder happens inside of a fudge? and would eagerly fudging the cause there as well also avoid this ICE?

Copy link
Contributor Author

@adwinwhite adwinwhite Nov 27, 2025

Choose a reason for hiding this comment

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

It's because of the definition of Obligation. So the region vars in cause is ignored in fudge_inference_if_ok.

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, but the fudge when computing the best obligation could take (Predicate, Cause) as the return type instead of a full obligation to properly fudge the cause there

@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 Nov 27, 2025
@adwinwhite adwinwhite changed the title Erase leaked regions in cause code when giving suggestion Fudge infer vars in the cause code of Obligation intentionally Nov 28, 2025
@adwinwhite
Copy link
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 28, 2025
@ShoyuVanilla
Copy link
Member

This fixes #142866 as well 👍

@rustbot
Copy link
Collaborator

rustbot commented Nov 28, 2025

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.

hm, can you move both tests to traits/error-reporting?

also, can you add a fixme to Obligation that we shouldn't ignore the cause but instead change teh affected visitors to only visit predicates manually :>

View changes since this review

@lcnr
Copy link
Contributor

lcnr commented Dec 1, 2025

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Dec 1, 2025

📌 Commit b111aed 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 Dec 1, 2025
bors added a commit that referenced this pull request Dec 1, 2025
Rollup of 9 pull requests

Successful merges:

 - #148690 (Implement `clamp_magnitude` method for primitive floats & signed integers)
 - #149102 (stabilize maybe_uninit_slice)
 - #149269 (cmse: do not calculate the layout of a type with infer types)
 - #149299 (Fudge infer vars in the cause code of `Obligation` intentionally)
 - #149344 (Don't suggest unwrap for Result in const)
 - #149358 (fix(parse): Limit frontmatter fences to 255 dashes )
 - #149445 (make assoc fn inherit const stability from inherent `const impl` blocks)
 - #149479 (Fix indent in E0591.md)
 - #149496 (Fix #148889: Add label rib when visiting delegation body)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit b8336a5 into rust-lang:main Dec 1, 2025
11 checks passed
@rustbot rustbot added this to the 1.93.0 milestone Dec 1, 2025
rust-timer added a commit that referenced this pull request Dec 1, 2025
Rollup merge of #149299 - adwinwhite:next-245-ice, r=lcnr

Fudge infer vars in the cause code of `Obligation` intentionally

Fixes the ICE variant in rust-lang/trait-system-refactor-initiative#245.
Fixes #142866.

The detailed cause is in the test comments.

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

Development

Successfully merging this pull request may close these issues.

ICE with -Znext-solver=globally: index out of bounds

6 participants