Add no_std attribute and extern crate core for wasm32v1-none

This commit is contained in:
2026-01-09 16:33:08 +03:00
parent 877abfe00e
commit c03215db8d
+7 -1
View File
@@ -97,7 +97,9 @@
// Serde types in rustdoc of other crates get linked to here.
#![doc(html_root_url = "https://docs.rs/serde/1.0.228")]
// Support using Serde without the standard library!
#![cfg_attr(not(feature = "std"), no_std)]
// Also force no_std on target_os = "none" (wasm32v1-none) even if std feature is enabled
// This handles Cargo feature unification where std gets enabled for no_std targets
#![cfg_attr(any(not(feature = "std"), target_os = "none"), no_std)]
// Show which crate feature enables conditionally compiled APIs in documentation.
#![cfg_attr(docsrs, feature(doc_cfg, rustdoc_internals))]
#![cfg_attr(docsrs, allow(internal_features))]
@@ -168,6 +170,10 @@
#[cfg(feature = "alloc")]
extern crate alloc;
// Explicitly import core crate for no_std targets (especially wasm32v1-none)
#[cfg(any(not(feature = "std"), target_os = "none"))]
extern crate core;
// Rustdoc has a lot of shortcomings related to cross-crate re-exports that make
// the rendered documentation of serde_core traits in serde more challenging to
// understand than the equivalent documentation of the same items in serde_core.