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.
177
177
- The value of the expression is formatted as a string and substituted directly into the asm template string.
178
178
179
+
r[asm.operand-type.supported-operands.label]
180
+
*`label <block>`
181
+
- The address of the block is substituted into the asm template string. The assembly block may jump to the substituted addresses.
182
+
- After execution of the block, the `asm!` expression returns.
183
+
- The type of the block must be unit or `!` (never).
184
+
- 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.
185
+
179
186
r[asm.operand-type.left-to-right]
180
187
Operand expressions are evaluated from left to right, just like function call arguments.
181
188
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).
547
554
Behavior is undefined if execution falls through past the end of the asm code.
548
555
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.
556
+
- 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.
557
+
The entire `asm!` block will have unit type in this case, unless all label blocks diverge, in which case the return type is `!`.
549
558
550
559
r[asm.options.supported-options.nostack]
551
560
-`nostack`: The `asm!` block does not push data to the stack, or write to the stack red-zone (if supported by the target).
@@ -569,7 +578,10 @@ r[asm.options.checks.pure]
569
578
- It is a compile-time error to specify `pure` on an asm block with no outputs or only discarded outputs (`_`).
570
579
571
580
r[asm.options.checks.noreturn]
572
-
- It is a compile-time error to specify `noreturn` on an asm block with outputs.
581
+
- It is a compile-time error to specify `noreturn` on an asm block with outputs and without labels.
582
+
583
+
r[asm.options.checks.label-with-outputs]
584
+
- It is a compile-time error to specify label on an asm block with outputs.
573
585
574
586
r[asm.options.global_asm-restriction]
575
587
`global_asm!` only supports the `att_syntax` and `raw` options.
0 commit comments