diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2438d88..779b7de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,26 @@ jobs: - run: ./examples/run_examples.sh - run: ./examples/example_crates/run_example_crates.sh + multi-targets-no-std: + name: multi-targets no_std + runs-on: ubuntu-latest + strategy: + matrix: + target: + - x86_64-unknown-linux-gnu + - x86_64-unknown-none + - aarch64-unknown-linux-gnu + - aarch64-unknown-none-softfloat + - riscv64gc-unknown-none-elf + - riscv64imac-unknown-none-elf + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + components: rustc, cargo + - run: cargo build --target ${{ matrix.target }} --no-default-features + rustfmt-check: name: rustfmt check runs-on: ubuntu-latest diff --git a/examples/example_crates/no_std/Cargo.toml b/examples/example_crates/no_std/Cargo.toml index 3611bc2..2b9acaa 100644 --- a/examples/example_crates/no_std/Cargo.toml +++ b/examples/example_crates/no_std/Cargo.toml @@ -9,3 +9,8 @@ version = "0.1.0" [dependencies] enumerable = { path = "../../../", default-features = false } + +[profile] +dev.panic = "abort" +release.panic = "abort" + diff --git a/examples/example_crates/no_std/src/main.rs b/examples/example_crates/no_std/src/main.rs index 534d6c8..54e6861 100644 --- a/examples/example_crates/no_std/src/main.rs +++ b/examples/example_crates/no_std/src/main.rs @@ -1,6 +1,6 @@ //! This example tests the `Enumerable` derive macro in a `no_std` environment. - -#![no_std] +//! +//! This example itself is not `no_std`, but it uses the `enumerable` crate with `default-features = false`. use enumerable::Enumerable; diff --git a/src/lib.rs b/src/lib.rs index 160619d..154b3e8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,4 @@ +#![cfg_attr(not(feature = "std"), no_std)] #![doc = include_str!("./CRATE_DOC.md")] /// `Enumerable` is a trait for types that can have their possible values enumerated.