瀏覽代碼

Invert 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 latter is a confusing "Rust exception must be
rethrown").

Link: https://github.com/rust-lang/rust/pull/130897 [1]
Gary Guo 8 月之前
父節點
當前提交
24c1b38355
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/panicking.rs

+ 2 - 2
src/panicking.rs

@@ -19,7 +19,7 @@ pub fn begin_panic<E: Exception>(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::<E>);
         _Unwind_RaiseException(ex)
     }
@@ -60,7 +60,7 @@ pub fn catch_unwind<E: Exception, R, F: FnOnce() -> R>(f: F) -> Result<R, Option
         unsafe {
             let data = &mut *(data as *mut ManuallyDrop<Option<E>>);
             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;