From afa2e6f2ff784af7e89d286acfd6d57d164223e0 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Wed, 13 Apr 2022 16:35:40 +0300 Subject: [PATCH] Fix targets not supporting `target_has_atomic = "ptr"` --- library/alloc/src/ffi/c_str.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/alloc/src/ffi/c_str.rs b/library/alloc/src/ffi/c_str.rs index 6a522c0cada76..172a008e89a06 100644 --- a/library/alloc/src/ffi/c_str.rs +++ b/library/alloc/src/ffi/c_str.rs @@ -6,7 +6,6 @@ use crate::boxed::Box; use crate::rc::Rc; use crate::slice::hack::into_vec; use crate::string::String; -use crate::sync::Arc; use crate::vec::Vec; use core::borrow::Borrow; use core::ffi::{c_char, CStr}; @@ -19,6 +18,9 @@ use core::slice; use core::slice::memchr; use core::str::{self, Utf8Error}; +#[cfg(target_has_atomic = "ptr")] +use crate::sync::Arc; + /// A type representing an owned, C-compatible, nul-terminated string with no nul bytes in the /// middle. /// @@ -859,6 +861,7 @@ impl<'a> From<&'a CString> for Cow<'a, CStr> { } } +#[cfg(target_has_atomic = "ptr")] #[stable(feature = "shared_from_slice2", since = "1.24.0")] impl From for Arc { /// Converts a [`CString`] into an [Arc]<[CStr]> by moving the [`CString`] @@ -870,6 +873,7 @@ impl From for Arc { } } +#[cfg(target_has_atomic = "ptr")] #[stable(feature = "shared_from_slice2", since = "1.24.0")] impl From<&CStr> for Arc { /// Converts a `&CStr` into a `Arc`,