]> git.lizzy.rs Git - rust.git/blob - src/test/ui/binding/match-join.rs
Merge commit '35d9c6bf256968e1b40e0d554607928bdf9cebea' into sync_cg_clif-2022-02-23
[rust.git] / src / test / ui / binding / match-join.rs
1 // run-pass
2 #![allow(unused_mut)]
3 fn foo<T>(y: Option<T>) {
4     let mut x: isize;
5     let mut rs: Vec<isize> = Vec::new();
6     /* tests that x doesn't get put in the precondition for the
7        entire if expression */
8
9     if true {
10     } else {
11         match y {
12           None::<T> => x = 17,
13           _ => x = 42
14         }
15         rs.push(x);
16     }
17     return;
18 }
19
20 pub fn main() { println!("hello"); foo::<isize>(Some::<isize>(5)); }