]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/complex.rs
cleanup: s/impl Copy/#[derive(Copy)]/g
[rust.git] / src / test / run-pass / complex.rs
1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11
12
13
14 type t = int;
15
16 fn nothing() { }
17
18 fn putstr(_s: String) { }
19
20 fn putint(_i: int) {
21     let mut i: int = 33;
22     while i < 36 { putstr("hi".to_string()); i = i + 1; }
23 }
24
25 fn zerg(i: int) -> int { return i; }
26
27 fn foo(x: int) -> int {
28     let mut y: t = x + 2;
29     putstr("hello".to_string());
30     while y < 10 { putint(y); if y * 3 == 4 { y = y + 2; nothing(); } }
31     let mut z: t;
32     z = 0x55;
33     foo(z);
34     return 0;
35 }
36
37 pub fn main() {
38     let x: int = 2i + 2;
39     println!("{}", x);
40     println!("hello, world");
41     println!("{}", 10i);
42 }