You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- The type of the expression may be any integer type, but defaults to `i32` just like integer literals.
181
181
- The value of the expression is formatted as a string and substituted directly into the asm template string.
182
182
183
+
r[asm.operand-type.supported-operands.label]
184
+
*`label <block>`
185
+
- The address of the block is substituted into the asm template string. The assembly block may jump to the substituted addresses.
186
+
- After execution of the block, the `asm!` expression returns.
187
+
- The type of the block must be unit or `!` (never).
188
+
- The block starts new safety context; despite the outer `unsafe` needed for `asm!`, you need an extra `unsafe` to perform unsafe operations inside the block.
189
+
183
190
r[asm.operand-type.left-to-right]
184
191
Operand expressions are evaluated from left to right, just like function call arguments.
185
192
After the `asm!` has executed, outputs are written to in left to right order.
-`noreturn`: The `asm!` block never returns, and its return type is defined as `!` (never).
554
561
Behavior is undefined if execution falls through past the end of the asm code.
555
562
A `noreturn` asm block behaves just like a function which doesn't return; notably, local variables in scope are not dropped before it is invoked.
563
+
- When labels are present, `noreturn` means the execution of the `asm!` block never falls through; the asm block may only exit by jumping to one of the specified blocks.
564
+
The entire `asm!` block will have unit type in this case, unless all label blocks diverge, in which case the return type is `!`.
556
565
557
566
r[asm.options.supported-options.nostack]
558
567
-`nostack`: The `asm!` block does not push data to the stack, or write to the stack red-zone (if supported by the target).
@@ -576,7 +585,10 @@ r[asm.options.checks.pure]
576
585
- It is a compile-time error to specify `pure` on an asm block with no outputs or only discarded outputs (`_`).
577
586
578
587
r[asm.options.checks.noreturn]
579
-
- It is a compile-time error to specify `noreturn` on an asm block with outputs.
588
+
- It is a compile-time error to specify `noreturn` on an asm block with outputs and without labels.
589
+
590
+
r[asm.options.checks.label-with-outputs]
591
+
- It is a compile-time error to specify label on an asm block with outputs.
580
592
581
593
r[asm.options.global_asm-restriction]
582
594
`global_asm!` only supports the `att_syntax` and `raw` options.
0 commit comments