From 03fb21903ae59cfcc2bb2034c84d2889bd986cc7 Mon Sep 17 00:00:00 2001 From: Oakchris1955 <80592203+Oakchris1955@users.noreply.github.com> Date: Sat, 4 Oct 2025 15:08:15 +0300 Subject: [PATCH] Fix for platforms not supporting atomic loads The `alloc::sync` module is only available on platforms that support atomic loads and stores of pointers. This may be detected at compile time using `#[cfg(target_has_atomic = ptr)]`. --- src/common/non_utf8/path.rs | 3 +++ src/common/utf8/path.rs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/common/non_utf8/path.rs b/src/common/non_utf8/path.rs index daedefe..33979d9 100644 --- a/src/common/non_utf8/path.rs +++ b/src/common/non_utf8/path.rs @@ -2,6 +2,7 @@ mod display; use alloc::borrow::{Cow, ToOwned}; use alloc::rc::Rc; +#[cfg(target_has_atomic = "ptr")] use alloc::sync::Arc; use core::hash::{Hash, Hasher}; use core::marker::PhantomData; @@ -1259,6 +1260,7 @@ where } } +#[cfg(target_has_atomic = "ptr")] impl From> for Arc> where T: Encoding, @@ -1272,6 +1274,7 @@ where } } +#[cfg(target_has_atomic = "ptr")] impl From<&Path> for Arc> where T: Encoding, diff --git a/src/common/utf8/path.rs b/src/common/utf8/path.rs index 371853a..1979e88 100644 --- a/src/common/utf8/path.rs +++ b/src/common/utf8/path.rs @@ -1,5 +1,6 @@ use alloc::borrow::{Cow, ToOwned}; use alloc::rc::Rc; +#[cfg(target_has_atomic = "ptr")] use alloc::sync::Arc; use core::hash::{Hash, Hasher}; use core::marker::PhantomData; @@ -1245,6 +1246,7 @@ where } } +#[cfg(target_has_atomic = "ptr")] impl From> for Arc> where T: Utf8Encoding, @@ -1258,6 +1260,7 @@ where } } +#[cfg(target_has_atomic = "ptr")] impl From<&Utf8Path> for Arc> where T: Utf8Encoding,