Skip to content

Variable is both used and unused when assigning asm!() to it #89305

Closed
@jonas-schievink

Description

@jonas-schievink
#![feature(asm)]

fn main() {
    unsafe {
        let x: () = asm!("nop");
    }
}
warning: unused variable: `x`
 --> src/main.rs:5:13
  |
5 |         let x: () = asm!("nop");
  |             ^ help: if this is intentional, prefix it with an underscore: `_x`
  |
  = note: `#[warn(unused_variables)]` on by default

error[E0381]: use of possibly-uninitialized variable: `x`
 --> src/main.rs:5:13
  |
5 |         let x: () = asm!("nop");
  |             ^ use of possibly-uninitialized `x`

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.F-asm`#![feature(asm)]` (not `llvm_asm`)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions