diff --git a/sixtyfps_runtime/corelib/Cargo.toml b/sixtyfps_runtime/corelib/Cargo.toml index 81f00e18f..34d759902 100644 --- a/sixtyfps_runtime/corelib/Cargo.toml +++ b/sixtyfps_runtime/corelib/Cargo.toml @@ -51,6 +51,7 @@ unicode-segmentation = "1.8.0" # Note: the rgb version is extracted in ci.yaml for rustdoc builds rgb = "0.8.27" pin-project = "1" +atomic-polyfill = { version = "0.1.5" } [target.'cfg(target_arch = "wasm32")'.dependencies] instant = { version = "0.1", features = [ "wasm-bindgen", "now" ] } diff --git a/sixtyfps_runtime/corelib/sharedvector.rs b/sixtyfps_runtime/corelib/sharedvector.rs index e96e00acd..c1478a1e9 100644 --- a/sixtyfps_runtime/corelib/sharedvector.rs +++ b/sixtyfps_runtime/corelib/sharedvector.rs @@ -15,7 +15,8 @@ use core::iter::FromIterator; use core::mem::MaybeUninit; use core::ops::Deref; use core::ptr::NonNull; -use core::sync::atomic; + +use atomic_polyfill as atomic; #[repr(C)] struct SharedVectorHeader { @@ -38,7 +39,7 @@ fn compute_inner_layout(capacity: usize) -> core::alloc::Layout { } unsafe fn drop_inner(mut inner: NonNull>) { - debug_assert_eq!(inner.as_ref().header.refcount.load(core::sync::atomic::Ordering::Relaxed), 0); + debug_assert_eq!(inner.as_ref().header.refcount.load(atomic::Ordering::Relaxed), 0); let data_ptr = inner.as_mut().data.as_mut_ptr(); for x in 0..inner.as_ref().header.size { core::ptr::drop_in_place(data_ptr.add(x)); @@ -377,7 +378,7 @@ impl Extend for SharedVector { } static SHARED_NULL: SharedVectorHeader = - SharedVectorHeader { refcount: core::sync::atomic::AtomicIsize::new(-1), size: 0, capacity: 0 }; + SharedVectorHeader { refcount: atomic::AtomicIsize::new(-1), size: 0, capacity: 0 }; impl Default for SharedVector { fn default() -> Self {