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.
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.
13 use std::{isize, i8, i16, i32, i64};
17 assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
18 //~^ ERROR attempt to divide with overflow
19 //~| ERROR this expression will panic at runtime
20 assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
21 //~^ ERROR attempt to divide with overflow
22 //~| ERROR this expression will panic at runtime
23 assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
24 //~^ ERROR attempt to divide with overflow
25 //~| ERROR this expression will panic at runtime
26 assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
27 //~^ ERROR attempt to divide with overflow
28 //~| ERROR this expression will panic at runtime
29 assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
30 //~^ ERROR attempt to divide with overflow
31 //~| ERROR this expression will panic at runtime
32 assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
33 //~^ ERROR attempt to divide by zero
34 //~| ERROR this expression will panic at runtime
35 assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
36 //~^ ERROR attempt to divide by zero
37 //~| ERROR this expression will panic at runtime
38 assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
39 //~^ ERROR attempt to divide by zero
40 //~| ERROR this expression will panic at runtime
41 assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
42 //~^ ERROR attempt to divide by zero
43 //~| ERROR this expression will panic at runtime
44 assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
45 //~^ ERROR attempt to divide by zero
46 //~| ERROR this expression will panic at runtime
47 assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
48 //~^ ERROR attempt to calculate the remainder with overflow
49 //~| ERROR this expression will panic at runtime
50 assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
51 //~^ ERROR attempt to calculate the remainder with overflow
52 //~| ERROR this expression will panic at runtime
53 assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
54 //~^ ERROR attempt to calculate the remainder with overflow
55 //~| ERROR this expression will panic at runtime
56 assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
57 //~^ ERROR attempt to calculate the remainder with overflow
58 //~| ERROR this expression will panic at runtime
59 assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
60 //~^ ERROR attempt to calculate the remainder with overflow
61 //~| ERROR this expression will panic at runtime
62 assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
63 //~^ ERROR attempt to calculate the remainder with a divisor of zero
64 //~| ERROR this expression will panic at runtime
65 assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
66 //~^ ERROR attempt to calculate the remainder with a divisor of zero
67 //~| ERROR this expression will panic at runtime
68 assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
69 //~^ ERROR attempt to calculate the remainder with a divisor of zero
70 //~| ERROR this expression will panic at runtime
71 assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
72 //~^ ERROR attempt to calculate the remainder with a divisor of zero
73 //~| ERROR this expression will panic at runtime
74 assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
75 //~^ ERROR attempt to calculate the remainder with a divisor of zero
76 //~| ERROR this expression will panic at runtime