rust-lang / rust-lang/rust-analyzer

Inline assembly has no semantic highlighting

Open
#21,254 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-highlighting C-feature
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

Inline assembly doesn't have any semantic highlighting, even though this was added in https://github.com/rust-lang/rust-analyzer/issues/6031.

All asm!()/global_asm/naked_asm calls are just highlighted as strings.

Image

It's possible I am missing some sort of configuration option, but I haven't seen anything of the sort in the rust-analyzer settings.

rust-analyzer version: 0.4.2715-standalone (f5a83fb3b5 2025-12-11)

rustc version: rustc 1.92.0-nightly (7ac0330c6 2025-09-25)

editor or extension: VS Code 1.106.3, RA extension 0.4.2715, Theme: Default Dark Modern

relevant settings: Rust target is aarch64-apple-darwin, but I've tested on multiple

code snippet to reproduce:

use std::arch::asm;

fn main() {
    unsafe {
        asm!("
            @ Perform a nop instruction.
            nop
        ");
    }
}

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 with the Rust snippet in the issue and reproduce the highlighting for asm!(), global_asm, and naked_asm in the listed VS Code and rust-analyzer versions. Trace the semantic-highlighting path for these calls and compare it with the behavior described in issue 6031. Done means inline assembly is highlighted semantically rather than entirely as strings, with the relevant behavior covered by tests.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.