Skip to content

introduce explicit "no_std" to avoid compiler errors on targets without "std"#57

Merged
aarkegz merged 5 commits intodevfrom
multi_target_no_std
Jul 12, 2025
Merged

introduce explicit "no_std" to avoid compiler errors on targets without "std"#57
aarkegz merged 5 commits intodevfrom
multi_target_no_std

Conversation

@aarkegz
Copy link
Contributor

@aarkegz aarkegz commented Jul 12, 2025

No description provided.

@aarkegz aarkegz requested a review from Copilot July 12, 2025 12:40
@aarkegz aarkegz self-assigned this Jul 12, 2025

This comment was marked as outdated.

@aarkegz aarkegz requested a review from Copilot July 12, 2025 13:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR ensures the crate compiles in environments without the Rust standard library by adding a conditional no_std flag, updates the no_std example, configures panic behavior, and verifies multiple no_std targets in CI.

  • Add conditional no_std attribute to the library when the std feature is disabled
  • Adjust example crate docs and profile settings for no_std usage
  • Introduce a CI job to build across various no_std targets

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/lib.rs Add #![cfg_attr(not(feature = "std"), no_std)] to crate root
examples/example_crates/no_std/src/main.rs Update documentation comments and clarify example behavior
examples/example_crates/no_std/Cargo.toml Add panic abort profile settings for dev and release
.github/workflows/ci.yml Add multi-target matrix job building without default features
Comments suppressed due to low confidence (3)

examples/example_crates/no_std/src/main.rs:2

  • [nitpick] This empty documentation line doesn’t add value and can be removed to keep the example’s doc comments concise.
//! 

examples/example_crates/no_std/src/main.rs:3

  • [nitpick] The explanation contradicts the first line which mentions testing in a no_std environment—either restore #![no_std] or update the first doc to match this crate’s actual configuration.
//! This example itself is not `no_std`, but it uses the `enumerable` crate with `default-features = false`.

.github/workflows/ci.yml:33

  • This job only builds the targets; consider running cargo test --target ${{ matrix.target }} --no-default-features to catch any platform-specific regressions.
      - run: cargo build --target ${{ matrix.target }} --no-default-features

@aarkegz aarkegz merged commit f601f75 into dev Jul 12, 2025
16 checks passed
@aarkegz aarkegz deleted the multi_target_no_std branch July 12, 2025 13:19
@aarkegz aarkegz added bug Something isn't working rust Something related to rust itself labels Jul 12, 2025
@aarkegz aarkegz added this to the v1.2 milestone Jul 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working rust Something related to rust itself

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants