2012-12-10 19:32:48 -06:00
|
|
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
fn foo(c: Vec<isize> ) {
|
|
|
|
let a: isize = 5;
|
|
|
|
let mut b: Vec<isize> = Vec::new();
|
2011-05-26 18:02:25 -05:00
|
|
|
|
2011-07-27 07:19:39 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
match t::none::<isize> {
|
|
|
|
t::some::<isize>(_) => {
|
2015-01-31 11:20:46 -06:00
|
|
|
for _i in &c {
|
2014-10-14 20:07:11 -05:00
|
|
|
println!("{}", a);
|
2015-01-25 15:05:03 -06:00
|
|
|
let a = 17;
|
2013-06-11 21:13:42 -05:00
|
|
|
b.push(a);
|
2013-06-21 07:29:53 -05:00
|
|
|
}
|
2011-12-22 16:42:52 -06:00
|
|
|
}
|
2013-06-21 07:29:53 -05:00
|
|
|
_ => { }
|
2011-05-26 18:02:25 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-19 20:31:08 -06:00
|
|
|
enum t<T> { none, some(T), }
|
2011-05-26 18:02:25 -05:00
|
|
|
|
2015-06-07 13:00:38 -05:00
|
|
|
pub fn main() { let x = 10; let x = x + 20; assert_eq!(x, 30); foo(Vec::new()); }
|