rust-lang / rust-lang/rust

`asm!` lints should be based on `cfg` rather than target

Open
#127,938 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-inline-assembly A-lints C-enhancement T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

For example:

#[cfg(target_arch = "x86")]
fn foo() {
    unsafe { asm!("0: jmp 0b") };
}

This currently raises binary_asm_labels only if targeting x86. Ideally we would be able to raise the lint regardless of what the current target is.

Requested in https://github.com/rust-lang/rust/issues/127821 and https://github.com/rust-lang/rust/pull/127935

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the asm! lint handling described in this issue and compare the requested behavior with issues #127821 and pull request #127935. Done means binary_asm_labels can be raised based on the applicable cfg regardless of the current compilation target.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.