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 address of the block is substituted into the asm template string. The assembly block may jump to the substituted addresses.
360
+
- After execution of the block, the `asm!` expression returns.
361
+
- The type of the block must be unit or `!` (never).
362
+
- 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.
363
+
364
+
```rust
365
+
# #[cfg(target_arch ="x86_64")]
366
+
unsafe {
367
+
core::arch::asm!("jmp {}", label {
368
+
println!("Hello from inline assembly label");
369
+
});
370
+
}
371
+
```
372
+
373
+
357
374
r[asm.operand-type.left-to-right]
358
375
Operand expressions are evaluated from left to right, just like function call arguments.
359
376
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).
1081
1098
Behavior is undefined if execution falls through past the end of the asm code.
1082
1099
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.
1100
+
- 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.
1101
+
The entire `asm!` block will have unit type in this case, unless all label blocks diverge, in which case the return type is `!`.
0 commit comments