diff options
| author | bors <bors@rust-lang.org> | 2025-03-17 19:04:14 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-03-17 19:04:14 +0000 |
| commit | 43a2e9d2c72db101f5fedac8b3acb78981b06bf2 (patch) | |
| tree | e8d860111ca96d9e2da9866d3bdbc5cf1a6a1c18 /src/doc | |
| parent | 8279176ccdfd4eebd40a671f75b6d3024ae56b42 (diff) | |
| parent | 1e58d512903836962af9633ec6ac03caad69cb32 (diff) | |
| download | rust-43a2e9d2c72db101f5fedac8b3acb78981b06bf2.tar.gz rust-43a2e9d2c72db101f5fedac8b3acb78981b06bf2.zip | |
Auto merge of #138611 - matthiaskrgr:rollup-hmjbqva, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #133870 (Stabilize `asm_goto` feature gate) - #137449 (Denote `ControlFlow` as `#[must_use]`) - #137465 (mir_build: Avoid some useless work when visiting "primary" bindings) - #138349 (Emit function declarations for functions with `#[linkage="extern_weak"]`) - #138412 (Install licenses into `share/doc/rust/licenses`) - #138577 (rustdoc-json: Don't also include `#[deprecated]` in `Item::attrs`) - #138588 (Avoid double lowering of idents) Failed merges: - #138321 ([bootstrap] Distribute split debuginfo if present) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src/doc')
| -rw-r--r-- | src/doc/unstable-book/src/language-features/asm-goto-with-outputs.md | 27 | ||||
| -rw-r--r-- | src/doc/unstable-book/src/language-features/asm-goto.md | 32 |
2 files changed, 27 insertions, 32 deletions
diff --git a/src/doc/unstable-book/src/language-features/asm-goto-with-outputs.md b/src/doc/unstable-book/src/language-features/asm-goto-with-outputs.md new file mode 100644 index 00000000000..3cce5d1d74c --- /dev/null +++ b/src/doc/unstable-book/src/language-features/asm-goto-with-outputs.md @@ -0,0 +1,27 @@ +# `asm_goto_with_outputs` + +The tracking issue for this feature is: [#119364] + +[#119364]: https://github.com/rust-lang/rust/issues/119364 + +------------------------ + +This feature allows label operands to be used together with output operands. + +Example: +```rust,ignore (partial-example, x86-only) + +unsafe { + let a: usize; + asm!( + "mov {}, 1" + "jmp {}", + out(reg) a, + label { + println!("Jumped from asm {}!", a); + } + ); +} +``` + +The output operands are assigned before the label blocks are executed. diff --git a/src/doc/unstable-book/src/language-features/asm-goto.md b/src/doc/unstable-book/src/language-features/asm-goto.md deleted file mode 100644 index 823118bcae1..00000000000 --- a/src/doc/unstable-book/src/language-features/asm-goto.md +++ /dev/null @@ -1,32 +0,0 @@ -# `asm_goto` - -The tracking issue for this feature is: [#119364] - -[#119364]: https://github.com/rust-lang/rust/issues/119364 - ------------------------- - -This feature adds a `label <block>` operand type to `asm!`. - -Example: -```rust,ignore (partial-example, x86-only) - -unsafe { - asm!( - "jmp {}", - label { - println!("Jumped from asm!"); - } - ); -} -``` - -The block must have unit type or diverge. The block starts a new safety context, -so despite outer `unsafe`, you need extra unsafe to perform unsafe operations -within `label <block>`. - -When `label <block>` is used together with `noreturn` option, it means that the -assembly will not fallthrough. It's allowed to jump to a label within the -assembly. In this case, the entire `asm!` expression will have an unit type as -opposed to diverging, if not all label blocks diverge. The `asm!` expression -still diverges if `noreturn` option is used and all label blocks diverge. |
