-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)A-lazy-normalizationArea: Lazy normalization (tracking issue: #60471)Area: Lazy normalization (tracking issue: #60471)T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
#72493 revealed an interesting interaction between coercion, the universe transition (#56105), and the transition to NLL (#57895). What happens in the old-lub-glb-hr-noteq[12].rs
tests introduced by that PR is:
- We have to compute the "coercion LUB" of
fn('a, 'b) -> 'a
andfn('a, 'a) -> 'a
. The "correct answer" isfn('a, 'a) -> 'a
. With NLL migration mode, we get a hard error always, but once we enable the NLL mode, our answer depends on the order of the match arms. - The reason is that the coercion code finds that it can create a subtype for either order, so it produces a result that depends on the ordering. That same code introduces a "equality" requirement in migration mode that results in an error no matter what. But when those errors are suppressed, we generate NLL, and we only enforce subtyping, which either works or doesn't, depending on what type was chosen.
How should we fix this?
- Keep the error? Unfortunate.
- Extend the leak check so it can distinguish these two types correctly and make the coercion code do a "evaluate" that includes a leak check.
Metadata
Metadata
Assignees
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)A-lazy-normalizationArea: Lazy normalization (tracking issue: #60471)Area: Lazy normalization (tracking issue: #60471)T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.