From 0c417574a308d86ef79823dccb215b2273ec800a Mon Sep 17 00:00:00 2001 From: Kurdistan Tech Ministry Date: Sat, 25 Apr 2026 21:56:17 +0300 Subject: [PATCH] fix: force no_std for wasm32v1-none target regardless of std feature cargo check --target wasm32v1-none uses workspace feature unification which may enable the std feature even for no_std targets. wasm32v1-none (bare-metal wasm, target_os=none) has no libstd available, so we must force no_std and the core-as-std alias for this specific target combination. --- src/lib.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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;