Skip to content

Commit afa2e6f

Browse files
committed
Fix targets not supporting target_has_atomic = "ptr"
1 parent 7f3cc2f commit afa2e6f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

library/alloc/src/ffi/c_str.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use crate::boxed::Box;
66
use crate::rc::Rc;
77
use crate::slice::hack::into_vec;
88
use crate::string::String;
9-
use crate::sync::Arc;
109
use crate::vec::Vec;
1110
use core::borrow::Borrow;
1211
use core::ffi::{c_char, CStr};
@@ -19,6 +18,9 @@ use core::slice;
1918
use core::slice::memchr;
2019
use core::str::{self, Utf8Error};
2120

21+
#[cfg(target_has_atomic = "ptr")]
22+
use crate::sync::Arc;
23+
2224
/// A type representing an owned, C-compatible, nul-terminated string with no nul bytes in the
2325
/// middle.
2426
///
@@ -859,6 +861,7 @@ impl<'a> From<&'a CString> for Cow<'a, CStr> {
859861
}
860862
}
861863

864+
#[cfg(target_has_atomic = "ptr")]
862865
#[stable(feature = "shared_from_slice2", since = "1.24.0")]
863866
impl From<CString> for Arc<CStr> {
864867
/// Converts a [`CString`] into an <code>[Arc]<[CStr]></code> by moving the [`CString`]
@@ -870,6 +873,7 @@ impl From<CString> for Arc<CStr> {
870873
}
871874
}
872875

876+
#[cfg(target_has_atomic = "ptr")]
873877
#[stable(feature = "shared_from_slice2", since = "1.24.0")]
874878
impl From<&CStr> for Arc<CStr> {
875879
/// Converts a `&CStr` into a `Arc<CStr>`,

0 commit comments

Comments
 (0)