introduce explicit "no_std" to avoid compiler errors on targets without "std"#57
Merged
introduce explicit "no_std" to avoid compiler errors on targets without "std"#57
Conversation
Contributor
There was a problem hiding this comment.
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_stdattribute to the library when thestdfeature 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_stdenvironment—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-featuresto catch any platform-specific regressions.
- run: cargo build --target ${{ matrix.target }} --no-default-features
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.
No description provided.