Skip to content

Commit

Permalink
Support Zeroable and Pod for f16 and f128
Browse files Browse the repository at this point in the history
These are gated under a new feature flag `nightly_float`.

Fixes: <#250>
  • Loading branch information
tgross35 committed Jun 19, 2024
1 parent d15b8e0 commit 3615dfc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ unsound_ptr_pod_impl = []
# NOT SEMVER SUPPORTED! TEMPORARY ONLY!
nightly_portable_simd = []
nightly_stdsimd = []
# Enable `f16` and `f128`
nightly_float = []

# Improved documentation using the nightly toolchain
nightly_docs = []
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#![allow(clippy::type_complexity)]
#![cfg_attr(feature = "nightly_docs", feature(doc_cfg))]
#![cfg_attr(feature = "nightly_portable_simd", feature(portable_simd))]
#![cfg_attr(feature = "nightly_float", feature(f16, f128))]
#![cfg_attr(
all(
feature = "nightly_stdsimd",
Expand Down
4 changes: 4 additions & 0 deletions src/pod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ unsafe impl Pod for usize {}
unsafe impl Pod for isize {}
unsafe impl Pod for u128 {}
unsafe impl Pod for i128 {}
#[cfg(feature = "nightly_float")]
unsafe impl Pod for f16 {}

Check failure on line 53 in src/pod.rs

View workflow job for this annotation

GitHub Actions / Test with miri

the trait bound `f16: zeroable::Zeroable` is not satisfied

Check failure on line 53 in src/pod.rs

View workflow job for this annotation

GitHub Actions / Test with -Zsanitizer=address

the trait bound `f16: zeroable::Zeroable` is not satisfied

Check failure on line 53 in src/pod.rs

View workflow job for this annotation

GitHub Actions / Test with -Zsanitizer=memory

the trait bound `f16: zeroable::Zeroable` is not satisfied

Check failure on line 53 in src/pod.rs

View workflow job for this annotation

GitHub Actions / Test with -Zsanitizer=leak

the trait bound `f16: zeroable::Zeroable` is not satisfied

Check failure on line 53 in src/pod.rs

View workflow job for this annotation

GitHub Actions / Test Rust nightly on ubuntu-latest

the trait bound `f16: zeroable::Zeroable` is not satisfied
unsafe impl Pod for f32 {}
unsafe impl Pod for f64 {}
#[cfg(feature = "nightly_float")]
unsafe impl Pod for f128 {}

Check failure on line 57 in src/pod.rs

View workflow job for this annotation

GitHub Actions / Test with miri

the trait bound `f128: zeroable::Zeroable` is not satisfied

Check failure on line 57 in src/pod.rs

View workflow job for this annotation

GitHub Actions / Test with -Zsanitizer=address

the trait bound `f128: zeroable::Zeroable` is not satisfied

Check failure on line 57 in src/pod.rs

View workflow job for this annotation

GitHub Actions / Test with -Zsanitizer=memory

the trait bound `f128: zeroable::Zeroable` is not satisfied

Check failure on line 57 in src/pod.rs

View workflow job for this annotation

GitHub Actions / Test with -Zsanitizer=leak

the trait bound `f128: zeroable::Zeroable` is not satisfied

Check failure on line 57 in src/pod.rs

View workflow job for this annotation

GitHub Actions / Test Rust nightly on ubuntu-latest

the trait bound `f128: zeroable::Zeroable` is not satisfied
unsafe impl<T: Pod> Pod for Wrapping<T> {}

#[cfg(feature = "unsound_ptr_pod_impl")]
Expand Down

0 comments on commit 3615dfc

Please sign in to comment.