Skip to content

Commit

Permalink
Build on 32-bit
Browse files Browse the repository at this point in the history
  • Loading branch information
SabrinaJewson committed Jan 10, 2025
1 parent 3591d22 commit 84df4ce
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
23 changes: 21 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand All @@ -34,7 +53,7 @@
},
{
"uses": "actions-rs/cargo@v1",
"with": { "command": "build", "args": "--all-targets --all-features" }
"with": { "command": "check", "args": "--all-features" }
}
]
},
Expand Down
8 changes: 8 additions & 0 deletions src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ where
// SAFETY: `Unique<I>` functions as a `SyncWrapper`
unsafe impl<I: Id> Sync for Unique<I> {}

#[cfg(target_has_atomic = "64")]

Check failure on line 46 in src/id.rs

View workflow job for this annotation

GitHub Actions / check-msrv

`cfg(target_has_atomic)` is experimental and subject to change
mod checked {
use super::Id;
use super::Unique;
Expand All @@ -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);

Expand Down Expand Up @@ -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")]

Check failure on line 88 in src/id.rs

View workflow job for this annotation

GitHub Actions / check-msrv

`cfg(target_has_atomic)` is experimental and subject to change
pub use checked::Checked;

mod unchecked {
Expand Down Expand Up @@ -113,13 +117,16 @@ mod unchecked {
}
pub use unchecked::Unchecked;

#[cfg(target_has_atomic = "64")]

Check failure on line 120 in src/id.rs

View workflow job for this annotation

GitHub Actions / check-msrv

`cfg(target_has_atomic)` is experimental and subject to change
mod debug_checked {
use super::Id;
use super::Unique;
use crate::id;

/// 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)]
Expand Down Expand Up @@ -151,6 +158,7 @@ mod debug_checked {
// SAFETY: Ensured by caller in `DebugChecked::new`
unsafe impl Id for DebugChecked {}
}
#[cfg(target_has_atomic = "64")]

Check failure on line 161 in src/id.rs

View workflow job for this annotation

GitHub Actions / check-msrv

`cfg(target_has_atomic)` is experimental and subject to change
pub use debug_checked::DebugChecked;

mod lifetime {
Expand Down

0 comments on commit 84df4ce

Please sign in to comment.