2012-12-11 01:32:48 +00: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.
|
|
|
|
|
2011-09-26 17:26:30 +00:00
|
|
|
// Just a grab bag of stuff that you wouldn't want to actually write.
|
2011-08-19 05:16:54 +00:00
|
|
|
|
2012-08-02 00:30:05 +00:00
|
|
|
fn strange() -> bool { let _x: bool = return true; }
|
2011-08-19 05:16:54 +00:00
|
|
|
|
|
|
|
fn funny() {
|
2011-08-19 22:16:48 +00:00
|
|
|
fn f(_x: ()) { }
|
2012-08-02 00:30:05 +00:00
|
|
|
f(return);
|
2011-08-19 05:16:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn what() {
|
2012-08-02 00:30:05 +00:00
|
|
|
fn the(x: @mut bool) { return while !*x { *x = true; }; }
|
2012-03-27 01:35:18 +00:00
|
|
|
let i = @mut false;
|
2012-06-20 02:34:01 +00:00
|
|
|
let dont = {||the(i)};
|
2011-08-19 05:16:54 +00:00
|
|
|
dont();
|
2013-03-06 21:58:02 +00:00
|
|
|
fail_unless!((*i));
|
2011-08-19 05:16:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn zombiejesus() {
|
2012-05-10 21:06:19 +00:00
|
|
|
loop {
|
2012-08-02 00:30:05 +00:00
|
|
|
while (return) {
|
|
|
|
if (return) {
|
2012-08-06 19:34:08 +00:00
|
|
|
match (return) {
|
2012-08-04 02:59:04 +00:00
|
|
|
1 => {
|
2012-08-02 00:30:05 +00:00
|
|
|
if (return) {
|
|
|
|
return
|
2012-01-30 03:58:16 +00:00
|
|
|
} else {
|
2012-08-02 00:30:05 +00:00
|
|
|
return
|
2012-01-30 03:58:16 +00:00
|
|
|
}
|
|
|
|
}
|
2012-08-04 02:59:04 +00:00
|
|
|
_ => { return }
|
2012-01-30 03:58:16 +00:00
|
|
|
};
|
2012-08-02 00:30:05 +00:00
|
|
|
} else if (return) {
|
|
|
|
return;
|
2011-09-16 04:24:24 +00:00
|
|
|
}
|
|
|
|
}
|
2012-08-02 00:30:05 +00:00
|
|
|
if (return) { break; }
|
2012-05-10 21:06:19 +00:00
|
|
|
}
|
2011-08-19 05:16:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn notsure() {
|
2012-03-22 15:39:41 +00:00
|
|
|
let mut _x;
|
|
|
|
let mut _y = (_x = 0) == (_x = 0);
|
2013-02-15 10:44:18 +00:00
|
|
|
let mut _z = (_x = 0) < (_x = 0);
|
2011-08-19 05:16:54 +00:00
|
|
|
let _a = (_x += 0) == (_x = 0);
|
|
|
|
let _b = (_y <-> _z) == (_y <-> _z);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn canttouchthis() -> uint {
|
2013-03-22 18:23:21 +00:00
|
|
|
fn p() -> bool { true }
|
2013-03-07 03:09:17 +00:00
|
|
|
let _a = (fail_unless!((true)) == (fail_unless!(p())));
|
2013-03-06 21:58:02 +00:00
|
|
|
let _c = (fail_unless!((p())) == ());
|
2013-03-07 03:09:17 +00:00
|
|
|
let _b: bool = (debug!("%d", 0) == (return 0u));
|
2011-08-19 05:16:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn angrydome() {
|
2012-03-10 00:11:56 +00:00
|
|
|
loop { if break { } }
|
2012-03-22 15:39:41 +00:00
|
|
|
let mut i = 0;
|
2013-02-12 03:26:38 +00:00
|
|
|
loop { i += 1; if i == 1 { match (loop) { 1 => { }, _ => fail!(~"wat") } }
|
2012-08-23 21:44:58 +00:00
|
|
|
break; }
|
2011-08-19 05:16:54 +00:00
|
|
|
}
|
|
|
|
|
2013-02-15 10:44:18 +00:00
|
|
|
fn evil_lincoln() { let evil = debug!("lincoln"); }
|
2011-08-19 05:16:54 +00:00
|
|
|
|
2013-02-02 03:43:17 +00:00
|
|
|
pub fn main() {
|
2011-08-19 05:16:54 +00:00
|
|
|
strange();
|
|
|
|
funny();
|
|
|
|
what();
|
|
|
|
zombiejesus();
|
|
|
|
notsure();
|
|
|
|
canttouchthis();
|
|
|
|
angrydome();
|
|
|
|
evil_lincoln();
|
|
|
|
}
|