rust-lang / rust-lang/rust

opt-level removes diagnostic output

Open
#152,448 1 comment 0 reactions 1 assignee View on GitHub

@LauraCastrillonMp is already working on this.

Since Feb 11, 2026.

A-diagnostics A-global-asm C-bug T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

use std::arch::global_asm;

macro_rules! wrap {
    () => {
        macro_rules! _a {
            () => {
                ":"
            };
        }
    };
}

wrap!();

use _a as a;

global_asm!(a!());

fn main() {}

rustc a.rs --edition=2021 -Copt-level=0

error: unexpected token at start of statement
  |
note: instantiated into assembly here
 --> <inline asm>:2:1
  |
2 | :
  | ^

error: aborting due to 1 previous error

rustc a.rs --edition=2021 -Copt-level=1

error: <inline asm>:2:1: unexpected token at start of statement
:
^

I would think the diagnostics would be the same regardless of codegen backend optimization level 🤔

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.