mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-29 03:27:44 +00:00

- Compatible with Emscripten 1.38.46-upstream or later upstream. - Refactors the Emscripten target spec to share code with other wasm targets. - Replaces the old incorrect wasm32 C call ABI with the correct one, preserving the old one as wasm32_bindgen_compat for wasm-bindgen compatibility. - Updates the varargs ABI used by Emscripten and deletes the old one. - Removes the obsolete wasm32-experimental-emscripten target. - Uses EMCC_CFLAGS on CI to avoid the timeout problems with #63649.
28 lines
695 B
Rust
28 lines
695 B
Rust
// run-pass
|
|
// compile-flags: -C debug_assertions=yes
|
|
// ignore-emscripten compiled with panic=abort by default
|
|
// ignore-emscripten dies with an LLVM error
|
|
|
|
use std::panic;
|
|
|
|
fn main() {
|
|
macro_rules! overflow_test {
|
|
($t:ident) => (
|
|
let r = panic::catch_unwind(|| {
|
|
($t::max_value()).next_power_of_two()
|
|
});
|
|
assert!(r.is_err());
|
|
|
|
let r = panic::catch_unwind(|| {
|
|
(($t::max_value() >> 1) + 2).next_power_of_two()
|
|
});
|
|
assert!(r.is_err());
|
|
)
|
|
}
|
|
overflow_test!(u8);
|
|
overflow_test!(u16);
|
|
overflow_test!(u32);
|
|
overflow_test!(u64);
|
|
overflow_test!(u128);
|
|
}
|