transmutability: Stall new solver when inference variables remain#149228
transmutability: Stall new solver when inference variables remain#149228lapla-cogito wants to merge 1 commit intorust-lang:mainfrom
Conversation
|
It seems wrong to return an error here. It should not be impossible to transmute. We should instead stall somehow here. There should probably just be an |
|
☔ The latest upstream changes (presumably #151003) made this pull request unmergeable. Please resolve the merge conflicts. |
|
@lapla-cogito any updates on this? thanks. |
|
I will update this patch in a few days. |
is_transmutable for non-region infers|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Since adding @rustbot ready |
| if goal.predicate.has_non_region_infer() { | ||
| return ecx.forced_ambiguity(MaybeCause::Ambiguity); | ||
| } |
There was a problem hiding this comment.
can you move this check into ecx.is_transmutable? That should be able to just return Certainty::AMBIGUOUS which is then properly handled already
we want to handle structurally_normalize_const to return something ambiguous or to take something that references an infer var and the returned assume then does not as the infer var wasn't used.
|
issue resolved in #154991 |
fixes #141400, fixes #148809
The new trait solver's
consider_builtin_transmute_candidate()was passing types with inference variables directly torustc_transmute(), which attempts layout computation and ICEs.The old solver already guards against this in
assemble_candidates_for_transmutability()by settingcandidates.ambiguous = true. Add the equivalent guard in the new solver by returningforced_ambiguitywhen the predicate contains non-region inference variables.