mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-18 11:34:11 +00:00
24 lines
496 B
Rust
24 lines
496 B
Rust
// Check shadowing in if let guards works as expected.
|
|
//@ check-pass
|
|
|
|
#![feature(if_let_guard)]
|
|
#![feature(let_chains)]
|
|
|
|
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;
|
|
}
|
|
_ => {}
|
|
}
|
|
}
|