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.
This commit is contained in:
+9
-2
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user