Skip to content

message-format-compiler: switch to no_std#16

Merged
Georgiy-Tugai merged 1 commit into
forest-rs:mainfrom
Georgiy-Tugai:compiler-no_std
Jun 5, 2026
Merged

message-format-compiler: switch to no_std#16
Georgiy-Tugai merged 1 commit into
forest-rs:mainfrom
Georgiy-Tugai:compiler-no_std

Conversation

@Georgiy-Tugai
Copy link
Copy Markdown
Collaborator

Add #![no_std] to the compiler crate with std as a default feature. Gate CompileError::IoError behind #[cfg(feature = "std")]. Replace std::collectionsalloc::collections, std::fmtcore::fmt, std::error::Errorcore::error::Error, and add explicit use alloc imports throughout. Replace std::collections::hash_map::DefaultHasher with a stored hashbrown::DefaultHashBuilder for stable hashing. Use libm for f64::{ceil,floor,fract} which are not available in core.

Declare the workspace dependency with default-features = false so that compile without std actually produces a no_std build. Direct dependents (resource crates, CLI, LSP, wind_tunnel) opt back in with features = ["std"].

Copy link
Copy Markdown
Contributor

@waywardmonkeys waywardmonkeys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just fix up to have fewer qualifications and land.

Comment thread crates/message-format-compiler/src/compile/frontend/matching.rs Outdated
Comment thread crates/message-format-compiler/src/compile/lowering.rs Outdated
Comment thread crates/message-format-compiler/src/syntax/semantic.rs Outdated
Add `#![no_std]` to the compiler crate with `std` as a default feature.
Gate `CompileError::IoError` behind `#[cfg(feature = "std")]`. Replace
`std::collections` → `alloc::collections`, `std::fmt` → `core::fmt`,
`std::error::Error` → `core::error::Error`, and add explicit `use alloc`
imports throughout. Replace `std::collections::hash_map::DefaultHasher`
with a stored `hashbrown::DefaultHashBuilder` for stable hashing. Use
`libm` for `f64::{ceil,floor,fract}` which are not available in core.

Declare the workspace dependency with `default-features = false` so that
`compile` without `std` actually produces a no_std build. Direct
dependents (resource crates, CLI, LSP, wind_tunnel) opt back in with
`features = ["std"]`.
@Georgiy-Tugai Georgiy-Tugai merged commit 86ec990 into forest-rs:main Jun 5, 2026
15 checks passed
@Georgiy-Tugai Georgiy-Tugai deleted the compiler-no_std branch June 5, 2026 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants