// 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 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. use std::num::Int; use std::thread; // Avoid using constants, which would trigger compile-time errors. fn min_val() -> T { Int::min_value() } fn zero() -> T { Int::zero() } fn main() { assert!(thread::spawn(move|| { min_val::() / -1; }).join().is_err()); assert!(thread::spawn(move|| { min_val::() / -1; }).join().is_err()); assert!(thread::spawn(move|| { min_val::() / -1; }).join().is_err()); assert!(thread::spawn(move|| { min_val::() / -1; }).join().is_err()); assert!(thread::spawn(move|| { min_val::() / -1; }).join().is_err()); assert!(thread::spawn(move|| { 1is / zero(); }).join().is_err()); assert!(thread::spawn(move|| { 1i8 / zero(); }).join().is_err()); assert!(thread::spawn(move|| { 1i16 / zero(); }).join().is_err()); assert!(thread::spawn(move|| { 1i32 / zero(); }).join().is_err()); assert!(thread::spawn(move|| { 1i64 / zero(); }).join().is_err()); assert!(thread::spawn(move|| { min_val::() % -1; }).join().is_err()); assert!(thread::spawn(move|| { min_val::() % -1; }).join().is_err()); assert!(thread::spawn(move|| { min_val::() % -1; }).join().is_err()); assert!(thread::spawn(move|| { min_val::() % -1; }).join().is_err()); assert!(thread::spawn(move|| { min_val::() % -1; }).join().is_err()); assert!(thread::spawn(move|| { 1is % zero(); }).join().is_err()); assert!(thread::spawn(move|| { 1i8 % zero(); }).join().is_err()); assert!(thread::spawn(move|| { 1i16 % zero(); }).join().is_err()); assert!(thread::spawn(move|| { 1i32 % zero(); }).join().is_err()); assert!(thread::spawn(move|| { 1i64 % zero(); }).join().is_err()); }