/src/test/run-pass/alt-join.rs
Rust | 22 lines | 16 code | 4 blank | 2 comment | 2 complexity | e8085bea7971eab85830db5bdf426791 MD5 | raw file
1 2use std; 3import option; 4 5fn foo<T>(y: option<T>) { 6 let mut x: int; 7 let mut rs: ~[int] = ~[]; 8 /* tests that x doesn't get put in the precondition for the 9 entire if expression */ 10 11 if true { 12 } else { 13 match y { 14 none::<T> => x = 17, 15 _ => x = 42 16 } 17 rs += ~[x]; 18 } 19 return; 20} 21 22fn main() { debug!{"hello"}; foo::<int>(some::<int>(5)); }