diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index daaf743..b67b0c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,26 @@ } ] }, - "build-msrv": { + "check-32bit": { + "runs-on": "ubuntu-latest", + "steps": [ + { "uses": "actions/checkout@v1" }, + { + "uses": "actions-rs/toolchain@v1", + "with": { + "toolchain": "stable", + "override": true, + "profile": "minimal", + "target": "riscv32i-unknown-none-elf", + } + }, + { + "uses": "actions-rs/cargo@v1", + "with": { "command": "check", "args": "--target=riscv32i-unknown-none-elf" } + } + ] + }, + "check-msrv": { "runs-on": "ubuntu-latest", "steps": [ { "uses": "actions/checkout@v1" }, @@ -34,7 +53,7 @@ }, { "uses": "actions-rs/cargo@v1", - "with": { "command": "build", "args": "--all-targets --all-features" } + "with": { "command": "check", "args": "--all-features" } } ] }, diff --git a/src/id.rs b/src/id.rs index fb38a4c..7f633a6 100644 --- a/src/id.rs +++ b/src/id.rs @@ -43,6 +43,7 @@ where // SAFETY: `Unique` functions as a `SyncWrapper` unsafe impl Sync for Unique {} +#[cfg(target_has_atomic = "64")] mod checked { use super::Id; use super::Unique; @@ -51,6 +52,8 @@ mod checked { use core::sync::atomic::AtomicU64; /// An allocator of IDs that uses a global atomic `u64` counter. + /// + /// This type is only available on platforms with 64-bit atomics. #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct Checked(NonZeroU64); @@ -82,6 +85,7 @@ mod checked { // SAFETY: `new` can never return two `u64`s with the same value. unsafe impl Id for Checked {} } +#[cfg(target_has_atomic = "64")] pub use checked::Checked; mod unchecked { @@ -113,6 +117,7 @@ mod unchecked { } pub use unchecked::Unchecked; +#[cfg(target_has_atomic = "64")] mod debug_checked { use super::Id; use super::Unique; @@ -120,6 +125,8 @@ mod debug_checked { /// Equivalent to [`id::Checked`] when `debug_assertions` are enabled, but equivalent to /// [`id::Unchecked`] in release. + /// + /// This type is only available on platforms with 64-bit atomics. #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct DebugChecked { #[cfg(debug_assertions)] @@ -151,6 +158,7 @@ mod debug_checked { // SAFETY: Ensured by caller in `DebugChecked::new` unsafe impl Id for DebugChecked {} } +#[cfg(target_has_atomic = "64")] pub use debug_checked::DebugChecked; mod lifetime {