summaryrefslogtreecommitdiffstats
path: root/tests/ui/numbers-arithmetic/issue-8460-const.rs
blob: 02e7567dafabb17dd0eece01f556ead52b2999fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// revisions: noopt opt opt_with_overflow_checks
//[noopt]compile-flags: -C opt-level=0
//[opt]compile-flags: -O
//[opt_with_overflow_checks]compile-flags: -C overflow-checks=on -O

// build-fail

use std::thread;

fn main() {
    assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err());
    //~^ ERROR operation will panic
    assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err());
    //~^ ERROR operation will panic
    assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err());
    //~^ ERROR operation will panic
    assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err());
    //~^ ERROR operation will panic
    assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err());
    //~^ ERROR operation will panic
    assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err());
    //~^ ERROR operation will panic
    assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err());
    //~^ ERROR operation will panic
    assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err());
    //~^ ERROR operation will panic
    assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err());
    //~^ ERROR operation will panic
    assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err());
    //~^ ERROR operation will panic
    assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err());
    //~^ ERROR operation will panic
    assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err());
    //~^ ERROR operation will panic
    assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err());
    //~^ ERROR operation will panic
    assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err());
    //~^ ERROR operation will panic
    assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err());
    //~^ ERROR operation will panic
    assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err());
    //~^ ERROR operation will panic
    assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err());
    //~^ ERROR operation will panic
    assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err());
    //~^ ERROR operation will panic
    assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err());
    //~^ ERROR operation will panic
    assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err());
    //~^ ERROR operation will panic
    assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err());
    //~^ ERROR operation will panic
    assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err());
    //~^ ERROR operation will panic
    assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err());
    //~^ ERROR operation will panic
    assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err());
    //~^ ERROR operation will panic
}