Skip to content

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

Closed

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`

Activity

  1. added
    A-diagnosticsArea: Messages for errors, warnings, and lints
    C-bugCategory: This is a bug.
    F-asm`#![feature(asm)]` (not `llvm_asm`)
    A-inline-assemblyArea: Inline assembly (`asm!(…)`)
    on Sep 27, 2021
  2. added a commit that references this issue on Sep 29, 2021
    38ba95d
  3. added a commit that references this issue on Sep 30, 2021
    c5f8675
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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