Skip to content

Tighten logfwd-core to no_std + forbid(unsafe_code) #267

Closed

Description

@strawgate

Summary

After all impure code is moved out, add structural enforcement to logfwd-core.

Steps

  1. Add #![no_std] and extern crate alloc to src/lib.rs
  2. Add #![forbid(unsafe_code)] (or via Cargo.toml lints)
  3. Replace any remaining std:: imports with core:: / alloc::
  4. Replace get_unchecked in ChunkIndex with safe indexing (measure perf impact)
  5. Configure strict clippy lints in Cargo.toml
  6. Add CI step: cargo build -p logfwd-core --target thumbv6m-none-eabi
  7. Add dependency allowlist check in CI
  8. Verify memchr works with default-features = false

Cargo.toml lints

[lints.rust]
unsafe_code = "forbid"
missing_docs = "warn"
unused_must_use = "deny"

[lints.clippy]
pedantic = { level = "warn", priority = -1 }
unwrap_used = "deny"
expect_used = "deny"
panic = "deny"
indexing_slicing = "deny"

Dependencies

Depends on #Phase1a, #Phase1b, #Phase1c completing. This is the final step that locks down core.

Assignability

Needs review — the no_std migration may uncover hidden std dependencies. The get_unchecked → safe indexing change needs perf measurement. Copilot can do the mechanical parts but someone needs to verify the perf impact and handle any compilation issues.

Parent: #262

Activity

  1. changed the title [-]Phase 1d: Tighten logfwd-core to no_std + forbid(unsafe_code)[/-] [+]Tighten logfwd-core to no_std + forbid(unsafe_code)[/+] on Mar 31, 2026
  2. strawgate commented on Mar 31, 2026

    @strawgate
    OwnerAuthor

    Done in PR #375. logfwd-core is #![no_std] + #![forbid(unsafe_code)] + #![warn(missing_docs)].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions