1 // Copyright 2015 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.
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.
11 #![feature(rustc_attrs)]
18 let should_fail = env::args().nth(1) == Some("bad".to_string());
20 assert_eq!(thread::spawn(debug_assert_eq).join().is_err(), should_fail);
21 assert_eq!(thread::spawn(debug_assert).join().is_err(), should_fail);
22 assert_eq!(thread::spawn(overflow).join().is_err(), should_fail);
25 fn debug_assert_eq() {
28 debug_assert_eq!({ hit1 = true; 1 }, { hit2 = true; 2 });
35 debug_assert!({ hit = true; false });
40 #[rustc_no_mir] // FIXME #29769 MIR overflow checking is TBD.
41 fn add(a: u8, b: u8) -> u8 { a + b }