Skip to content

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

Closed

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

Activity

  1. added
    [C] Bug
    on Aug 24, 2022
  2. self-assigned this
    on Aug 24, 2022
  3. added this to the Maintenance milestone on Sep 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

[C] Bug

Type

No type

Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions