Skip to content

Commit 6207ede

Browse files
committed
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: rust-lang/rust#130381 [1]
1 parent e651ead commit 6207ede

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/panicking.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub fn begin_panic<E: Exception>(exception: E) -> UnwindReasonCode {
1919

2020
let ex = E::wrap(exception);
2121
unsafe {
22-
(*ex).exception_class = u64::from_be_bytes(E::CLASS);
22+
(*ex).exception_class = u64::from_ne_bytes(E::CLASS);
2323
(*ex).exception_cleanup = Some(exception_cleanup::<E>);
2424
_Unwind_RaiseException(ex)
2525
}
@@ -60,7 +60,7 @@ pub fn catch_unwind<E: Exception, R, F: FnOnce() -> R>(f: F) -> Result<R, Option
6060
unsafe {
6161
let data = &mut *(data as *mut ManuallyDrop<Option<E>>);
6262
let exception = exception as *mut UnwindException;
63-
if (*exception).exception_class != u64::from_be_bytes(E::CLASS) {
63+
if (*exception).exception_class != u64::from_ne_bytes(E::CLASS) {
6464
_Unwind_DeleteException(exception);
6565
*data = ManuallyDrop::new(None);
6666
return;

0 commit comments

Comments
 (0)