Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stabilize asm_goto feature gate #133870

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

nbdd0121
Copy link
Contributor

@nbdd0121 nbdd0121 commented Dec 4, 2024

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

Reference PR: rust-lang/reference#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 unsafes; the effect of unsafe that surrounds asm! block is cancelled. See #119364 (comment) and #131544.

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

Example:

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

@rustbot
Copy link
Collaborator

rustbot commented Dec 4, 2024

r? @ehuss

rustbot has assigned @ehuss.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 4, 2024
@nbdd0121
Copy link
Contributor Author

nbdd0121 commented Dec 4, 2024

@rustbot label: -T-compiler +T-lang +A-inline-assembly +F-asm

Cc @rust-lang/wg-inline-asm

@rustbot rustbot added A-inline-assembly Area: Inline assembly (`asm!(…)`) F-asm `#![feature(asm)]` (not `llvm_asm`) T-lang Relevant to the language team, which will review and decide on the PR/issue. and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 4, 2024
@ehuss
Copy link
Contributor

ehuss commented Dec 4, 2024

r? compiler

cc @Amanieu

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Dec 4, 2024
@rustbot rustbot assigned nnethercote and unassigned ehuss Dec 4, 2024
@ehuss ehuss added I-lang-nominated Nominated for discussion during a lang team meeting. and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 4, 2024
@nnethercote
Copy link
Contributor

The code changes look fine for stabilizing this feature, so r=me in terms of code. But I am uncertain about the stabilization process. Is any additional T-lang approval needed before this merges? Has such approval already been obtained?

@nbdd0121
Copy link
Contributor Author

nbdd0121 commented Dec 4, 2024

@nnethercote this would need a FCP.

@jieyouxu
Copy link
Member

jieyouxu commented Dec 5, 2024

r? lang (for T-lang FCP)

@rustbot rustbot assigned tmandry and unassigned nnethercote Dec 5, 2024
@traviscross
Copy link
Contributor

@rfcbot fcp merge

Thanks @nbdd0121 for putting forward this stabilization. We talked about it in lang triage today. Let's propose this for FCP.

@rfcbot
Copy link

rfcbot commented Dec 11, 2024

Team member @traviscross has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns.
See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Dec 11, 2024
@traviscross
Copy link
Contributor

traviscross commented Dec 12, 2024

@rustbot labels +S-waiting-on-documentation

Note that after the FCP completes, this shouldn't merge until the Reference PR is reviewed and approved.

(Thanks @nbdd0121 for creating this PR.)

cc @ehuss

@rustbot rustbot added the S-waiting-on-documentation Status: Waiting on approved PRs to documentation before merging label Dec 12, 2024
@nikomatsakis
Copy link
Contributor

@rfcbot reviewed

@rfcbot rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Dec 18, 2024
@rfcbot
Copy link

rfcbot commented Dec 18, 2024

🔔 This is now entering its final comment period, as per the review above. 🔔

@Amanieu
Copy link
Member

Amanieu commented Dec 19, 2024

A thought occurs: is label really the right keyword to use here to indicate a block? While it is true is that the address of the given block is represented as a label in the asm code, label doesn't really convey what the label actually points to (a block of Rust code) and the fact that this label is an exit from which the assembly code returns control to Rust code.

With that said I don't really have any better ideas for a keyword (other than goto, but that's not a concept that really exists in Rust).

@tmandry
Copy link
Member

tmandry commented Dec 19, 2024

@rfcbot reviewed

(Already checked my box, but rfcbot doesn't seem to register this.)

@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Dec 28, 2024
@rfcbot
Copy link

rfcbot commented Dec 28, 2024

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.

@rfcbot rfcbot added the to-announce Announce this issue on triage meeting label Dec 28, 2024
@traviscross
Copy link
Contributor

traviscross commented Dec 29, 2024

Note that this is still pending acceptance of the Reference PR, and it should not be merged until the S-waiting-on-documentation label is removed.

@traviscross traviscross removed the I-lang-nominated Nominated for discussion during a lang team meeting. label Jan 8, 2025
@bors
Copy link
Contributor

bors commented Jan 9, 2025

☔ The latest upstream changes (presumably #135286) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-inline-assembly Area: Inline assembly (`asm!(…)`) disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. F-asm `#![feature(asm)]` (not `llvm_asm`) finished-final-comment-period The final comment period is finished for this PR / Issue. S-waiting-on-documentation Status: Waiting on approved PRs to documentation before merging S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-lang Relevant to the language team, which will review and decide on the PR/issue. to-announce Announce this issue on triage meeting
Projects
None yet
Development

Successfully merging this pull request may close these issues.