/src/test/run-pass/alt-join.rs
http://github.com/jruderman/rust · Rust · 22 lines · 16 code · 4 blank · 2 comment · 3 complexity · e8085bea7971eab85830db5bdf426791 MD5 · raw file
- use std;
- import option;
- fn foo<T>(y: option<T>) {
- let mut x: int;
- let mut rs: ~[int] = ~[];
- /* tests that x doesn't get put in the precondition for the
- entire if expression */
- if true {
- } else {
- match y {
- none::<T> => x = 17,
- _ => x = 42
- }
- rs += ~[x];
- }
- return;
- }
- fn main() { debug!{"hello"}; foo::<int>(some::<int>(5)); }