2014-06-05 14:23:34 -05:00
|
|
|
// Copyright 2014 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.
|
|
|
|
|
2016-02-11 05:34:41 -06:00
|
|
|
// ignore-emscripten no threads support
|
2016-10-05 22:44:59 -05:00
|
|
|
#![feature(rustc_attrs, zero_one)]
|
2015-03-22 15:13:15 -05:00
|
|
|
|
2015-04-18 00:12:20 -05:00
|
|
|
use std::num::Zero;
|
2015-02-17 17:24:34 -06:00
|
|
|
use std::thread;
|
2014-06-05 14:23:34 -05:00
|
|
|
|
2016-03-10 13:20:09 -06:00
|
|
|
macro_rules! check {
|
|
|
|
($($e:expr),*) => {
|
|
|
|
$(assert!(thread::spawn({
|
|
|
|
move|| { $e; }
|
|
|
|
}).join().is_err());)*
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-05 14:23:34 -05:00
|
|
|
fn main() {
|
2016-03-10 13:20:09 -06:00
|
|
|
check![
|
|
|
|
isize::min_value() / -1,
|
|
|
|
i8::min_value() / -1,
|
|
|
|
i16::min_value() / -1,
|
|
|
|
i32::min_value() / -1,
|
|
|
|
i64::min_value() / -1,
|
|
|
|
1isize / isize::zero(),
|
|
|
|
1i8 / i8::zero(),
|
|
|
|
1i16 / i16::zero(),
|
|
|
|
1i32 / i32::zero(),
|
|
|
|
1i64 / i64::zero(),
|
|
|
|
isize::min_value() % -1,
|
|
|
|
i8::min_value() % -1,
|
|
|
|
i16::min_value() % -1,
|
|
|
|
i32::min_value() % -1,
|
|
|
|
i64::min_value() % -1,
|
|
|
|
1isize % isize::zero(),
|
|
|
|
1i8 % i8::zero(),
|
|
|
|
1i16 % i16::zero(),
|
|
|
|
1i32 % i32::zero(),
|
|
|
|
1i64 % i64::zero()
|
|
|
|
];
|
2014-06-05 14:23:34 -05:00
|
|
|
}
|