Skip to content

Commit c2c890a

Browse files
committed
Add some docs for copyable_to_moveonlywrapper_addr and moveonlywrapper_to_copyable_addr.
(cherry picked from commit 68fd68b)
1 parent ca8341a commit c2c890a

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

docs/SIL.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8460,6 +8460,33 @@ need for the guaranteed form in the future.
84608460
@moveOnly trivial type, we convert from the non-trivial representation to the
84618461
trivial representation.
84628462

8463+
copyable_to_moveonlywrapper_addr
8464+
````````````````````````````````
8465+
::
8466+
8467+
sil-instruction ::= 'copyable_to_moveonlywrapper_addr'
8468+
8469+
`copyable_to_moveonlywrapper_addr`_ takes in a '*T' and maps it to a move only
8470+
wrapped '*@moveOnly T'. This is semantically used by a code generator
8471+
initializing a new moveOnly binding from a copyable value. It semantically acts
8472+
as an address cast. If one thinks of '@moveOnly' as a monad, this is how one
8473+
injects a copyable value into the move only space.
8474+
8475+
moveonlywrapper_to_copyable_addr
8476+
````````````````````````````````
8477+
::
8478+
8479+
sil-instruction ::= 'moveonlywrapper_to_copyable_addr'
8480+
8481+
`moveonlywrapper_to_copyable_addr`_ takes in a '*@moveOnly T' and produces a new
8482+
'*T' value. This instruction acts like an address cast that projects out the
8483+
underlying T from an @moveOnly T.
8484+
8485+
NOTE: From the perspective of the address checker, a trivial `load`_ with a
8486+
`moveonlywrapper_to_copyable_addr`_ operand is considered to be a use of a
8487+
noncopyable type.
8488+
8489+
84638490
Assertion configuration
84648491
~~~~~~~~~~~~~~~~~~~~~~~
84658492

0 commit comments

Comments
 (0)