Skip to content

Inline asm errors don't report file/line no information #72664

Closed
@roblabla

Description

@roblabla

When an error within the assembly body of an inline asm happens (such as an invalid opcode), rust reports the error without pointing which inline asm instance (e.g. which file/line) caused it to happen. For instance:

#![feature(asm)]
fn main() {
    unsafe {asm!("out al, dx");}
}

The above "wrong" inline asm (on x86 32-bit) will report the following:

  Compiling playground v0.0.1 (/playground)
error: <inline asm>:2:2: error: invalid operand for instruction
        out al, dx
        ^

This makes it hard to track down where the error is caused.

Playground link.

Meta

rustc version: 1.45.0-nightly(2020-05-26 5239f5c)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-inline-assemblyArea: Inline assembly (`asm!(…)`)C-bugCategory: This is a bug.D-papercutDiagnostics: An error or lint that needs small tweaks.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.F-asm`#![feature(asm)]` (not `llvm_asm`)T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions