Open
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.