Skip to content

Tracking issue for release notes of #133870: Stabilize asm_goto feature gate #134860

Open
@rustbot

Description

@rustbot

This issue tracks the release notes text for #133870.

Steps

  • Proposed text is drafted by PR author (or team) making the noteworthy change.
  • Issue is nominated for release team review of clarity for wider audience.
  • Release team includes text in release notes/blog posts.

Release notes text

The responsible team for the underlying change should edit this section to replace the automatically generated link with a succinct description of what changed, drawing upon text proposed by the author (either in discussion or through direct editing).

# Language
- [Stabilize `asm_goto` feature](https://github.com/rust-lang/rust/pull/133870)

Tip

Use the previous releases categories to help choose which one(s) to use.
The category will be de-duplicated with all the other ones by the release team.

More than one section can be included if needed.

Release blog section

If the change is notable enough for inclusion in the blog post, the responsible team should add content to this section.
Otherwise leave it empty.

# Stabilization of `asm_goto`  

The `asm_goto` feature is now stabilized, allowing inline assembly (`asm!`) to jump to labeled blocks within Rust code. This enables more flexible low-level programming, such as implementing optimized control flow in OS kernels or interacting with hardware more efficiently. 

- The `asm!` macro now supports a label operand, which acts as a jump target.  
- The label must be a block expression with a return type of `()` or `!`.  
- The block executes when jumped to, and execution continues after the `asm!` block.  
- The safety context inside the block is separate, requiring explicit `unsafe` markings for unsafe operations.  
- Using `asm_goto` with output operands (`asm_goto_with_outputs`) remains unstable and is tracked separately.  

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

cc @nbdd0121, @tmandry -- origin issue/PR authors and assignees for starting to draft text

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-inline-assemblyArea: Inline assembly (`asm!(…)`)F-asm`#![feature(asm)]` (not `llvm_asm`)T-langRelevant to the language team, which will review and decide on the PR/issue.release-blog-postMarks issues tracking what text to put in the release blog post.relnotesMarks issues that should be documented in the release notes of the next release.relnotes-tracking-issueMarks issues tracking what text to put in release notes.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions