diff --git a/src/lib.rs b/src/lib.rs index f9a2fe6..07884f8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -20,12 +20,19 @@ //! This version of arrayvec requires Rust 1.51 or later. //! #![doc(html_root_url="https://docs.rs/arrayvec/0.7/")] -#![cfg_attr(not(feature="std"), no_std)] +// no_std when std feature is disabled, OR when compiling for wasm32v1-none +// (a bare-metal wasm target with no libstd, regardless of feature flags set +// by the host workspace — cargo check --target wasm32v1-none unifies features +// from the whole workspace which may include std=true). +#![cfg_attr( + any(not(feature = "std"), all(target_arch = "wasm32", target_os = "none")), + no_std +)] #[cfg(feature="serde")] extern crate serde; -#[cfg(not(feature="std"))] +#[cfg(any(not(feature = "std"), all(target_arch = "wasm32", target_os = "none")))] extern crate core as std; pub(crate) type LenUint = u32;