Skip to content

Spurious ununused variable warning for variables used as panic arguments #1582

@zhassan-aws

Description

@zhassan-aws

I tried this code:

#[kani::proof]
fn main() {
    let x = Some(1);
    match x {
        Some(y) => panic!("Value of y is {}", y),
        None => {}
    }
}

using the following command line invocation:

kani panic_arg.rs

with Kani version : 499e35f

I expected to see this happen: No warnings about y since it's used in the panic macro.

Instead, this happened:

warning: unused variable: `y`
 --> panic_arg.rs:5:14
  |
5 |         Some(y) => panic!("Value of y is {}", y),
  |              ^ help: if this is intentional, prefix it with an underscore: `_y`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: 1 warning emitted

Metadata

Metadata

Assignees

Labels

[C] BugThis is a bug. Something isn't working.

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions