mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SILGen optimizes creation of closure down a thin function when it has
no captures:
%1 = thin_to_thick_function %0
: $@convention(thin) () -> () to $@callee_guaranteed () -> ()
ValueOwnership.cpp has a sketchy optimization that treat the result
like a trivial type, even though it is not:
> CONSTANT_OWNERSHIP_INST(None, ThinToThickFunction)
commit 8c5737d1d5
Date: Fri Oct 23 15:12:18 2020 -0700
[ownership] Change thin_to_thick function to always produce a none value.
This creates a mismatch between the SILType and the SILValue
ownership. This is not a coherent design--we have a similar problem
with enums which is endlessly buggy--but reverting the decision will
be hard. Instead, I'll hack the memory verifier to silence this case.
Fixes rdar://115735132 (Lifetime verifier error with opaque return
type and closure)
36 KiB
36 KiB