Skip to content

Conversation

@adwinwhite
Copy link
Contributor

@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 21, 2025
@adwinwhite
Copy link
Contributor Author

adwinwhite commented Nov 21, 2025

This already fixes the issue. I wonder whether skipping proving the trait goal in NormalizesTo is still needed?

Oh, the ICE variant is not fixed yet. Let me have a look.

@adwinwhite
Copy link
Contributor Author

Minimization 1 and 3 compile with the next solver.
And minimization 2 (the ICE one) produces the same error message with the old solver now.

// We can erase them since evaluation later doesn't care about regions anyway.
let parent_trait_pred =
self.tcx.erase_and_anonymize_regions(cause.derived.parent_trait_pred);
try_borrowing(parent_trait_pred, &[])
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The old solver doesn't cause ICE because it doesn't eagerly resolve vars before canonicalizing the predicate.

Copy link
Contributor

Choose a reason for hiding this comment

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

hm, can you move this into a separate PR, makes it easier to approve the rest of this one

The old solver doesn't cause ICE because it doesn't eagerly resolve vars before canonicalizing the predicate.

so the parent_trait_pred has leaking infer vars in both solvers? ah well, please move this into a separate PR, I would like to potentially fix this closer to the root of the leaked infer vars.

@rust-log-analyzer

This comment has been minimized.

/// Consider a clause specifically for a `dyn Trait` self type. This requires
/// additionally checking all of the supertraits and object bounds to hold,
/// since they're not implied by the well-formedness of the object type.
/// `NormalizesTo` overrides this to not check the supertraits, for backwards
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// `NormalizesTo` overrides this to not check the supertraits, for backwards
///
/// `NormalizesTo` overrides this to not check the supertraits for backwards

then(ecx)
}

fn probe_and_consider_object_bound_candidate(
Copy link
Contributor

Choose a reason for hiding this comment

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

please add a comment here as well that this differs from trait goals with a FIXME(-Zhigher-ranked-assumptions) that we should try to unify these again once we properly support binders, linking to the issue fixed by this change

Comment on lines +6 to +7
// The old solver doesn't check the supertraits of the principal trait
// when considering object candidate for normalization.
Copy link
Contributor

Choose a reason for hiding this comment

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

... and the new solver previously did, resulting in a placeholder error while normalizing inside of a generator witness

// We can erase them since evaluation later doesn't care about regions anyway.
let parent_trait_pred =
self.tcx.erase_and_anonymize_regions(cause.derived.parent_trait_pred);
try_borrowing(parent_trait_pred, &[])
Copy link
Contributor

Choose a reason for hiding this comment

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

hm, can you move this into a separate PR, makes it easier to approve the rest of this one

The old solver doesn't cause ICE because it doesn't eagerly resolve vars before canonicalizing the predicate.

so the parent_trait_pred has leaking infer vars in both solvers? ah well, please move this into a separate PR, I would like to potentially fix this closer to the root of the leaked infer vars.

@lcnr
Copy link
Contributor

lcnr commented Nov 25, 2025

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Nov 25, 2025

📌 Commit 525cdc7 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 Nov 25, 2025
bors added a commit that referenced this pull request Nov 25, 2025
Rollup of 8 pull requests

Successful merges:

 - #147736 (Stabilize `asm_cfg`)
 - #148652 (Cleanup and refactor FnCtxt::report_no_match_method_error)
 - #149167 (skip checking supertraits in object candidate for `NormalizesTo` goal)
 - #149210 (fix: Do not ICE on normalization failure of an extern static item)
 - #149268 (add implementation-internal namespace for globalasm)
 - #149274 (Fix invalid link generation for type alias methods)
 - #149302 (Fix comment wording in simplify_comparison_integral.rs)
 - #149305 (Simplify OnceCell Clone impl)

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

skip checking supertraits in object candidate for `NormalizesTo` goal

Fixes rust-lang/trait-system-refactor-initiative#245.

r? `@lcnr`
github-actions bot pushed a commit to rust-lang/compiler-builtins that referenced this pull request Nov 27, 2025
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#147736 (Stabilize `asm_cfg`)
 - rust-lang/rust#148652 (Cleanup and refactor FnCtxt::report_no_match_method_error)
 - rust-lang/rust#149167 (skip checking supertraits in object candidate for `NormalizesTo` goal)
 - rust-lang/rust#149210 (fix: Do not ICE on normalization failure of an extern static item)
 - rust-lang/rust#149268 (add implementation-internal namespace for globalasm)
 - rust-lang/rust#149274 (Fix invalid link generation for type alias methods)
 - rust-lang/rust#149302 (Fix comment wording in simplify_comparison_integral.rs)
 - rust-lang/rust#149305 (Simplify OnceCell Clone impl)

r? `@ghost`
`@rustbot` modify labels: rollup
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.

thirtyfour non-Send witness regression

5 participants