Commit Graph

3 Commits

Author SHA1 Message Date
Michael Gottesman
0b38bbaba0 Update some allocbox to stack tests given I removed early allocbox to stack. 2023-05-15 11:18:17 -07:00
Michael Gottesman
224674cad1 [move-only] Ensure that we treat captured escaping closure arguments as such even if the closure doesn't actually escape
Specifically, we already have the appropriate semantics for arguments captured
by escaping closures but in certain cases allocbox to stack is able to prove
that the closure doesn’t actually escape. This results in the capture being
converted into a non-escaping SIL form. This then causes the move checker to
emit the wrong kind of error.

The solution is to create an early allocbox to stack that doesn’t promote move
only types in boxes from heap -> stack if it is captured by an escaping closure
but does everything else normally. Then once the move checking is completed, we
run alloc box to stack an additional time to ensure that we keep the guarantee
that heap -> stack is performed in those cases.

rdar://108905586
2023-05-04 12:25:19 -07:00
Michael Gottesman
a31d550348 [allocbox-to-stack] Add a new semantics attribute that says vars of a nominal type marked with _semantics("boxtostack.mustbeonstack") must be on the stack. 2019-12-02 20:29:52 -08:00