aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/if_let_expr.rs
blob: b0879e5fadbb495e8a1a15efd239a60044fc25be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#[lang = "sized"]
pub trait Sized {}

pub enum Option<T> {
    None,
    Some(T),
}

fn main() {
    let x = Option::Some(3);

    let a = if let Option::Some(1) = x {// { dg-warning "unused name" }
        1
    } else if x == Option::Some(2) {
        2
    } else if let Option::Some(y) = x {
        y
    } else {
        -1
    };
}