Skip to content

Commit eb81baf

Browse files
authored
Merge pull request #947 from stargazing-dino/no_std_sync
Use alloc for `Shared` type
2 parents ae662cb + 1ae69a1 commit eb81baf

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/func/native.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,17 @@ impl<T> SendSync for T {}
3030

3131
/// Immutable reference-counted container.
3232
#[cfg(not(feature = "sync"))]
33-
pub use std::rc::Rc as Shared;
33+
// TODO: Further audit no_std compatibility
34+
// When building with no_std + sync features, explicit imports from alloc
35+
// are needed despite using no_std_compat. This fixed compilation errors
36+
// around missing trait implementations for some users.
37+
pub use alloc::rc::Rc as Shared;
3438
/// Immutable reference-counted container.
3539
#[cfg(feature = "sync")]
36-
pub use std::sync::Arc as Shared;
40+
// TODO: Further audit no_std compatibility
41+
// While no_std_compat should map std::sync::Arc to alloc::sync::Arc,
42+
// there appear to be cases where this mapping fails.
43+
pub use alloc::sync::Arc as Shared;
3744

3845
/// Synchronized shared object.
3946
#[cfg(not(feature = "sync"))]

0 commit comments

Comments
 (0)