diff --git a/src/future.rs b/src/future.rs index d7f4cc7..402897e 100644 --- a/src/future.rs +++ b/src/future.rs @@ -15,7 +15,7 @@ //! # }); //! ``` -#[cfg(feature = "alloc")] +#[cfg(all(not(feature = "std"), feature = "alloc"))] extern crate alloc; #[doc(no_inline)] @@ -35,7 +35,7 @@ use std::{ #[cfg(feature = "race")] use fastrand::Rng; -#[cfg(feature = "alloc")] +#[cfg(all(not(feature = "std"), feature = "alloc"))] use alloc::boxed::Box; use core::task::{Context, Poll}; diff --git a/src/stream.rs b/src/stream.rs index bf78458..6be35d2 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -15,13 +15,13 @@ //! # }); //! ``` -#[cfg(feature = "alloc")] +#[cfg(all(not(feature = "std"), feature = "alloc"))] extern crate alloc; #[doc(no_inline)] pub use futures_core::stream::Stream; -#[cfg(feature = "alloc")] +#[cfg(all(not(feature = "std"), feature = "alloc"))] use alloc::boxed::Box; use core::fmt;