about summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/src
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-03-17 16:34:47 +0100
committerGitHub <noreply@github.com>2025-03-17 16:34:47 +0100
commit3d3f817ff92a9a59e6f2ed50ff76c01800614654 (patch)
treea17bb23e36a29a9a9441d1ebb1da329ed0cb42cb /compiler/rustc_pattern_analysis/src
parent9c67cecd12d79f1bbc00a74f70e7ef9fff086a5a (diff)
parent292c622507391dabd0434adcc6437edb193ac5be (diff)
downloadrust-3d3f817ff92a9a59e6f2ed50ff76c01800614654.tar.gz
rust-3d3f817ff92a9a59e6f2ed50ff76c01800614654.zip
Rollup merge of #133870 - nbdd0121:asm, r=traviscross,nnethercote
Stabilize `asm_goto` feature gate

Stabilize `asm_goto` feature (tracked by #119364). The issue will remain open and be updated to track `asm_goto_with_outputs`.

Reference PR: https://github.com/rust-lang/reference/pull/1693

# Stabilization Report

This feature adds a `label <block>` operand type to `asm!`. `<block>` must be a block expression with type unit or never. The address of the block is substituted and the assembly may jump to the block. When block completes the `asm!` block returns and continues execution.

The block starts a new safety context and unsafe operations within must have additional `unsafe`s; the effect of `unsafe` that surrounds `asm!` block is cancelled. See https://github.com/rust-lang/rust/issues/119364#issuecomment-2316037703 and https://github.com/rust-lang/rust/pull/131544.

It's currently forbidden to use `asm_goto` with output operands; that is still unstable under `asm_goto_with_outputs`.

Example:

```rust
unsafe {
    asm!(
        "jmp {}",
        label {
            println!("Jumped from asm!");
        }
    );
}
```

Tests:
- tests/ui/asm/x86_64/goto.rs
- tests/ui/asm/x86_64/goto-block-safe.stderr
- tests/ui/asm/x86_64/bad-options.rs
- tests/codegen/asm/goto.rs
Diffstat (limited to 'compiler/rustc_pattern_analysis/src')
0 files changed, 0 insertions, 0 deletions