浏览代码

Update to new Rust toolchain

Jeremy Soller 2 年之前
父节点
当前提交
0bd476d28a
共有 4 个文件被更改,包括 12 次插入7 次删除
  1. 0 1
      rust-toolchain
  2. 3 0
      rust-toolchain.toml
  3. 4 1
      src/lib.rs
  4. 5 5
      src/platform/pte.rs

+ 0 - 1
rust-toolchain

@@ -1 +0,0 @@
-nightly-2022-03-18

+ 3 - 0
rust-toolchain.toml

@@ -0,0 +1,3 @@
+[toolchain]
+channel = "nightly-2023-01-21"
+components = ["rust-src"]

+ 4 - 1
src/lib.rs

@@ -2,6 +2,7 @@
 #![allow(non_camel_case_types)]
 #![allow(non_upper_case_globals)]
 #![allow(unused_variables)]
+#![feature(alloc_error_handler)]
 #![feature(allocator_api)]
 #![feature(array_chunks)]
 #![feature(asm_const)]
@@ -19,6 +20,8 @@
 #![allow(clippy::derive_hash_xor_eq)]
 #![allow(clippy::eval_order_dependence)]
 #![allow(clippy::mut_from_ref)]
+// TODO: fix these
+#![warn(unaligned_references)]
 
 #[macro_use]
 extern crate alloc;
@@ -87,7 +90,7 @@ pub extern "C" fn rust_begin_unwind(pi: &::core::panic::PanicInfo) -> ! {
 pub extern "C" fn rust_eh_personality() {}
 
 #[cfg(not(test))]
-#[lang = "oom"]
+#[alloc_error_handler]
 #[linkage = "weak"]
 #[no_mangle]
 pub extern "C" fn rust_oom(layout: ::core::alloc::Layout) -> ! {

+ 5 - 5
src/platform/pte.rs

@@ -384,7 +384,7 @@ pub unsafe extern "C" fn pte_osSemaphoreCancellablePend(
 
 #[no_mangle]
 pub unsafe extern "C" fn pte_osAtomicExchange(ptarg: *mut c_int, val: c_int) -> c_int {
-    intrinsics::atomic_xchg(ptarg, val)
+    intrinsics::atomic_xchg_seqcst(ptarg, val)
 }
 
 #[no_mangle]
@@ -393,22 +393,22 @@ pub unsafe extern "C" fn pte_osAtomicCompareExchange(
     exchange: c_int,
     comp: c_int,
 ) -> c_int {
-    intrinsics::atomic_cxchg(pdest, comp, exchange).0
+    intrinsics::atomic_cxchg_seqcst_seqcst(pdest, comp, exchange).0
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn pte_osAtomicExchangeAdd(pAppend: *mut c_int, value: c_int) -> c_int {
-    intrinsics::atomic_xadd(pAppend, value)
+    intrinsics::atomic_xadd_seqcst(pAppend, value)
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn pte_osAtomicDecrement(pdest: *mut c_int) -> c_int {
-    intrinsics::atomic_xadd(pdest, -1) - 1
+    intrinsics::atomic_xadd_seqcst(pdest, -1) - 1
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn pte_osAtomicIncrement(pdest: *mut c_int) -> c_int {
-    intrinsics::atomic_xadd(pdest, 1) + 1
+    intrinsics::atomic_xadd_seqcst(pdest, 1) + 1
 }
 
 #[no_mangle]