about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/Linker.cpp
diff options
context:
space:
mode:
authorJack Huey <31162821+jackh726@users.noreply.github.com>2022-05-22 11:37:40 -0400
committerGitHub <noreply@github.com>2022-05-22 11:37:40 -0400
commit4f97de8dc5f62b6e379c26dc1796a3fa9944c14b (patch)
tree671c071c67cbf211cd0da4b4550578b85f6890f3 /compiler/rustc_llvm/llvm-wrapper/Linker.cpp
parent41994470de02a8d3b0f5759db09fd199f519c41a (diff)
parent683a9c8391f73a5fd9b39efd7b1179f6a2264ae2 (diff)
downloadrust-4f97de8dc5f62b6e379c26dc1796a3fa9944c14b.tar.gz
rust-4f97de8dc5f62b6e379c26dc1796a3fa9944c14b.zip
Rollup merge of #97206 - jackh726:issue-73154, r=nikomatsakis
Do leak check after function pointer coercion

cc #73154

I still need to clean diagnostics just a tad, but figured I would put this up anyways.

This change is made in order to make match arm coercion order-independent.

Basically, any time we do function pointer coercion, we follow it by doing a leak check. This is necessary because the LUB code doesn't handler higher-ranked things correctly, leading us to "coerce", but use the wrong type. A proper fix is to actually fix that code (so the type returned by `unify_and` is a supertype of both `a` and `b` if `Ok`). However, that requires a more in-depth fix, likely heavily overlapping with the new subtyping changes.

Here, I've been conservative and error early if we generate unsatisfiable constraints. Note, this should *mostly* only affect NLL, since migrate mode falls back to the LUB implementation (followed by leak check), whereas NLL only does sub.

There could be other coercion code that has an order-dependence where a leak check in the coercion code might be useful. However, this is more of a spot-fix for #73154 than a "permanent" fix, since we likely want to go the other way long-term, and allow this pattern without error.

r? `@nikomatsakis`
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/Linker.cpp')
0 files changed, 0 insertions, 0 deletions