blob: e7946a2a23b114c5fd6b5ca92a6e87c37557f0e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
// Check shadowing in if let guards works as expected.
//@ check-pass
//@ edition: 2024
#![feature(if_let_guard)]
fn main() {
let x: Option<Option<i32>> = Some(Some(6));
match x {
Some(x) if let Some(x) = x => {
let _: i32 = x;
}
_ => {}
}
let y: Option<Option<Option<i32>>> = Some(Some(Some(-24)));
match y {
Some(y) if let Some(y) = y && let Some(y) = y => {
let _: i32 = y;
}
_ => {}
}
}
|