]>
Commit | Line | Data |
---|---|---|
85aaf69f SL |
1 | // Copyright 2014 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 | ||
b039eaaf SL |
11 | #![deny(const_err)] |
12 | ||
c34b1796 | 13 | use std::{isize, i8, i16, i32, i64}; |
85aaf69f SL |
14 | use std::thread; |
15 | ||
16 | fn main() { | |
c34b1796 | 17 | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); |
b039eaaf | 18 | //~^ ERROR attempted to divide with overflow |
85aaf69f | 19 | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); |
b039eaaf | 20 | //~^ ERROR attempted to divide with overflow |
85aaf69f | 21 | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); |
b039eaaf | 22 | //~^ ERROR attempted to divide with overflow |
85aaf69f | 23 | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); |
b039eaaf | 24 | //~^ ERROR attempted to divide with overflow |
85aaf69f | 25 | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); |
b039eaaf | 26 | //~^ ERROR attempted to divide with overflow |
85aaf69f | 27 | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); |
b039eaaf | 28 | //~^ ERROR attempted to divide by zero |
85aaf69f | 29 | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); |
b039eaaf | 30 | //~^ ERROR attempted to divide by zero |
85aaf69f | 31 | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); |
b039eaaf | 32 | //~^ ERROR attempted to divide by zero |
85aaf69f | 33 | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); |
b039eaaf | 34 | //~^ ERROR attempted to divide by zero |
85aaf69f | 35 | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); |
b039eaaf | 36 | //~^ ERROR attempted to divide by zero |
c34b1796 | 37 | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); |
54a0048b | 38 | //~^ ERROR attempted to calculate the remainder with overflow |
85aaf69f | 39 | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); |
54a0048b | 40 | //~^ ERROR attempted to calculate the remainder with overflow |
85aaf69f | 41 | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); |
54a0048b | 42 | //~^ ERROR attempted to calculate the remainder with overflow |
85aaf69f | 43 | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); |
54a0048b | 44 | //~^ ERROR attempted to calculate the remainder with overflow |
85aaf69f | 45 | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); |
54a0048b | 46 | //~^ ERROR attempted to calculate the remainder with overflow |
85aaf69f | 47 | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); |
54a0048b | 48 | //~^ ERROR attempted to calculate the remainder with a divisor of zero |
85aaf69f | 49 | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); |
54a0048b | 50 | //~^ ERROR attempted to calculate the remainder with a divisor of zero |
85aaf69f | 51 | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); |
54a0048b | 52 | //~^ ERROR attempted to calculate the remainder with a divisor of zero |
85aaf69f | 53 | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); |
54a0048b | 54 | //~^ ERROR attempted to calculate the remainder with a divisor of zero |
85aaf69f | 55 | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); |
54a0048b | 56 | //~^ ERROR attempted to calculate the remainder with a divisor of zero |
85aaf69f | 57 | } |