From 6207ede2a05c4702c9dc1ce79b2a3553ca34fe10 Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Tue, 8 Oct 2024 20:25:19 +0100 Subject: [PATCH] Revert MOZ\0RUST endianness This was changed in upstream Rust recently [1], so change to follow suit. The error message is slightly different between exception from another Rust runtime and a complete foreign exception. (The message for later is a confusing "Rust exception must be rethrown"). Link: https://github.com/rust-lang/rust/pull/130381 [1] --- src/panicking.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/panicking.rs b/src/panicking.rs index 805a210..c906db6 100644 --- a/src/panicking.rs +++ b/src/panicking.rs @@ -19,7 +19,7 @@ pub fn begin_panic(exception: E) -> UnwindReasonCode { let ex = E::wrap(exception); unsafe { - (*ex).exception_class = u64::from_be_bytes(E::CLASS); + (*ex).exception_class = u64::from_ne_bytes(E::CLASS); (*ex).exception_cleanup = Some(exception_cleanup::); _Unwind_RaiseException(ex) } @@ -60,7 +60,7 @@ pub fn catch_unwind R>(f: F) -> Result>); let exception = exception as *mut UnwindException; - if (*exception).exception_class != u64::from_be_bytes(E::CLASS) { + if (*exception).exception_class != u64::from_ne_bytes(E::CLASS) { _Unwind_DeleteException(exception); *data = ManuallyDrop::new(None); return;