Enable nice wasm panic messages by default (#3619)

By accident it was already enabled in master for quite some time. To
make sure that we don't blow up the wasm binary size, I compiled the
binary with the feature enabled and disabled. With nice panic messages
enabled, the binary size increases by 908 bytes. Given the value that
this feature brings, I think it is okay to have these panic messages
enabled by default.
This commit is contained in:
Bastian Köcher
2019-09-17 11:28:32 +02:00
committed by GitHub
parent 84d0c790f3
commit 96c781834d
4 changed files with 4 additions and 16 deletions
-1
View File
@@ -37,6 +37,5 @@ std = [
]
nightly = []
strict = []
wasm-nice-panic-message = []
no_panic_handler = []
no_oom = []
+2 -13
View File
@@ -28,19 +28,8 @@ use codec::Decode;
#[no_mangle]
pub fn panic(info: &PanicInfo) -> ! {
unsafe {
#[cfg(feature = "wasm-nice-panic-message")]
{
let message = rstd::alloc::format!("{}", info);
extern_functions_host_impl::ext_print_utf8(message.as_ptr() as *const u8, message.len() as u32);
}
#[cfg(not(feature = "wasm-nice-panic-message"))]
{
if let Some(loc) = info.location() {
extern_functions_host_impl::ext_print_utf8(loc.file().as_ptr() as *const u8, loc.file().len() as u32);
extern_functions_host_impl::ext_print_num(loc.line() as u64);
extern_functions_host_impl::ext_print_num(loc.column() as u64);
}
}
let message = rstd::alloc::format!("{}", info);
extern_functions_host_impl::ext_print_utf8(message.as_ptr() as *const u8, message.len() as u32);
intrinsics::abort()
}
}