Skip to content

no-std Step 6: flip #![no_std] flag in lib.rs and fix remaining std couplings #419

Description

@Mec-iS

Sub-task of #413. Depends on #414, #415, #416, #417, #418 being complete.

What

Flip the no_std gate in src/lib.rs:

#![cfg_attr(not(feature = "std"), no_std)]
extern crate alloc; // brings Vec/String/Box into scope under no_std

And add the std feature to Cargo.toml:

[features]
default = ["std"]
std = []   # on/off marker; rand/std_rng already controlled by std_rand

After the flag is thrown, run cargo check --no-default-features and iterate on any remaining std:: couplings not caught by Steps 1–5. Expect one round of fixing before the check goes green.

Notes

  • extern crate alloc is required even in edition 2024 for no_std builds.
  • The default = ["std"] ensures all existing users are unaffected (backward compatible).
  • Verify the wasm js feature path still compiles: cargo build --target wasm32-unknown-unknown --features js.

Acceptance

  • cargo check --no-default-features exits 0 (no std leakage)
  • cargo build --features default exits 0 (backward compat)
  • cargo build --target wasm32-unknown-unknown --features js exits 0
  • cargo test --all-features passes
  • cargo +1.85.0 build --no-default-features exits 0 (MSRV on no-std path)

Estimated effort: ~1 hr

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions