docs: track making the generated Rust crate no_std#90
Draft
mario4tier wants to merge 1 commit into
Draft
Conversation
Tracking note (deferred follow-on, not a blocker) for migrating the generated Rust crate to #![no_std]. The sole heap blocker is runtime-sized Vec<f64> temp buffers in 17 of 163 indicator files (no String usage); the upcoming abstract/introspection module is already no_std-clean. Records the two approaches (extern crate alloc first; true zero-alloc later), that the fix lives in the generator (rust_lang.rs + scaffolding) not the generated output, and acceptance criteria (no_std build + ta_regtest 161/161 unchanged + no hot-path regression). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tracking PR (don't forget) — do not merge as-is
Complete plan kept in this description (the in-repo
docs/plans/*.mdwill be cleaned up once implemented).Captures a deferred follow-on: migrating the generated Rust crate to
#![no_std]. Filed so it isn't lost; it is not a blocker for the Rust abstract/introspection layer work (that module is alreadyno_std-clean by design).Assumption to validate
Crate-wide
no_stdis strictly better and feasible. Benefits: runs on any target with (eventually without) an allocator — WASM, embedded — and enforces the same zero-/bounded-allocation discipline the C reference already has with stack temp buffers.Current state
ta_codegen_output/rust/isstd-only (declaresno_stdnowhere).Vec<f64>temp/scratch buffers in 17 of 163 indicator files. NoString/format!anywhere in indicator code.no_std-clean by design (&'static/consttables, enums, slices), so it adds no debt.The 17 files:
accbands, adxr, apo, atr, bbands, dema, ma, macd, macdext, mavp, natr, ppo, stoch, stochf, stochrsi, tema, trixExample (
atr.rs): range-sized scratch buffer mirroring the C reference's stack temp buffers.Approach (the fix lives in the GENERATOR —
tools/ta_codegen/src/backends/rust_lang.rs+ scaffolding inmain.rs— never hand-editta_codegen_output/)extern crate alloc(minimal, low risk, recommended first): emit#![no_std]+extern crate alloc;and switch temp buffers toalloc::vec::Vec. Runs on any allocator target incl. WASM; no algorithm/signature changes.Vecscratch with caller-provided/bounded/stack buffers, removing the allocator requirement. Touches the 17 functions and possibly the public surface. Defer unless a no-allocator target is required.Recommended: A first, revisit B only if an allocator-free target becomes a real need.
Acceptance criteria
#ta_regtest --codegen --language=ruststill 161/161 — no behavior changestdbuildno_std-cleanta_codegen_output/is regenerated, never hand-edited🤖 Generated with Claude Code