From 910e216bdb7ee24d4a21633e003282d3e786f7c7 Mon Sep 17 00:00:00 2001 From: Kathryn Long Date: Wed, 8 Oct 2025 19:26:41 -0400 Subject: [PATCH 1/3] Remove docs.rs `doc_auto_cfg` feature and just wait until doc cfg stabilized. Fixes #135 --- src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 75554a2..24051e4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -64,7 +64,6 @@ #![cfg_attr(not(feature = "std"), no_std)] #![doc(html_root_url = "https://docs.rs/float16/0.1.3")] #![doc(test(attr(deny(warnings), allow(unused))))] -#![cfg_attr(docsrs, feature(doc_auto_cfg))] // Until updated to use newly stabilized `from_bits`, disable new lint warning about the transmutes #![allow(unknown_lints, unnecessary_transmutes)] #![warn(unknown_lints)] From c09068a61f76b549e3b28ebc8f20e38d0402db34 Mon Sep 17 00:00:00 2001 From: Kathryn Long Date: Wed, 8 Oct 2025 19:38:55 -0400 Subject: [PATCH 2/3] Ignore some tests in miri (due to diff floating point handling) --- src/bfloat.rs | 3 +++ src/binary16.rs | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/bfloat.rs b/src/bfloat.rs index 89f8a9e..5e4a0d3 100644 --- a/src/bfloat.rs +++ b/src/bfloat.rs @@ -1689,6 +1689,7 @@ mod test { } #[test] + #[cfg_attr(miri, ignore)] fn test_bf16_to_f64() { let f = bf16::from_f64(7.0); assert_eq!(f.to_f64(), 7.0f64); @@ -1762,6 +1763,7 @@ mod test { #[test] #[allow(clippy::erasing_op, clippy::identity_op)] + #[cfg_attr(miri, ignore)] fn round_to_even_f32() { // smallest positive subnormal = 0b0.0000_001 * 2^-126 = 2^-133 let min_sub = bf16::from_bits(1); @@ -1803,6 +1805,7 @@ mod test { #[test] #[allow(clippy::erasing_op, clippy::identity_op)] + #[cfg_attr(miri, ignore)] fn round_to_even_f64() { // smallest positive subnormal = 0b0.0000_001 * 2^-126 = 2^-133 let min_sub = bf16::from_bits(1); diff --git a/src/binary16.rs b/src/binary16.rs index d16c4f8..2cd8cf5 100644 --- a/src/binary16.rs +++ b/src/binary16.rs @@ -1563,6 +1563,7 @@ mod test { use super::*; #[test] + #[cfg_attr(miri, ignore)] fn test_f16_consts() { // DIGITS let digits = ((f16::MANTISSA_DIGITS as f32 - 1.0) * 2f32.log10()).floor() as u32; @@ -1790,6 +1791,7 @@ mod test { } #[test] + #[cfg_attr(miri, ignore)] fn test_f16_to_f32() { let f = f16::from_f32(7.0); assert_eq!(f.to_f32(), 7.0f32); @@ -1808,6 +1810,7 @@ mod test { } #[test] + #[cfg_attr(miri, ignore)] fn test_f16_to_f64() { let f = f16::from_f64(7.0); assert_eq!(f.to_f64(), 7.0f64); @@ -1880,6 +1883,7 @@ mod test { #[test] #[allow(clippy::erasing_op, clippy::identity_op)] + #[cfg_attr(miri, ignore)] fn round_to_even_f32() { // smallest positive subnormal = 0b0.0000_0000_01 * 2^-14 = 2^-24 let min_sub = f16::from_bits(1); @@ -1921,6 +1925,7 @@ mod test { #[test] #[allow(clippy::erasing_op, clippy::identity_op)] + #[cfg_attr(miri, ignore)] fn round_to_even_f64() { // smallest positive subnormal = 0b0.0000_0000_01 * 2^-14 = 2^-24 let min_sub = f16::from_bits(1); From 6ca4d363ed1dd3a17d446050678d9eb31407fbd4 Mon Sep 17 00:00:00 2001 From: Kathryn Long Date: Wed, 8 Oct 2025 20:11:58 -0400 Subject: [PATCH 3/3] Update changelog and URLs --- CHANGELOG.md | 9 +++++++++ Cargo.toml | 10 ---------- README.md | 2 +- src/bfloat.rs | 4 ++-- src/binary16.rs | 4 ++-- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 323bd08..114f410 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,12 +5,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Removed + +- `doc_auto_cfg` feature has been removed from docs.rs documentation due to removal of rust + feature. + ## [0.1.4][v0.1.4] - 2024-12-21 ### Fixed - `min` and `max` incorrectly propagate `NaN` values when `self` is `NaN`. Fixes [#126], by [@mgottscho]. +- Suppressed warnings from new `unnecessary_transmutes` lint. ## [0.1.3][v0.1.3] - 2024-12-21 @@ -492,6 +498,9 @@ These were all changes for half, which `float16` is a fork of. [@eiz]: https://github.com/eiz [@comath]: https://github.com/comath [@mgottscho]: https://github.com/mgottscho +[@djsell]: https://github.com/djsell +[@heiher]: https://github.com/heiher +[@majian4work]: https://github.com/majian4work diff --git a/Cargo.toml b/Cargo.toml index 02465dc..87e0029 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,16 +25,6 @@ exclude = [ default = ["std"] std = [] -[lints.rust.unexpected_cfgs] -level = "warn" -check-cfg = [ - 'cfg(kani)', - 'cfg(target_arch, values("spirv"))', - 'cfg(target_feature, values("IntegerFunctions2INTEL", "SPV_INTEL_shader_integer_functions2"))', - 'cfg(has_x86_intrinsics)', - 'cfg(has_aarch64_intrinsics)', -] - [dependencies] cfg-if = "1.0.0" diff --git a/README.md b/README.md index 8882375..8c1b72b 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This a fork of [half](https://crates.io/crates/half/), which removes most dependencies and fixing minor correctness issues (at a minor performance penalty). This has no affiliation to [`half`]. - + [![Crates.io](https://img.shields.io/crates/v/float16.svg)](https://crates.io/crates/float16/) [![Documentation](https://docs.rs/float16/badge.svg)](https://docs.rs/float16/) ![Crates.io](https://img.shields.io/crates/l/half) [![Build status](https://github.com/Alexhuszagh/float16/actions/workflows/rust.yml/badge.svg?branch=main&event=push)](https://github.com/Alexhuszagh/float16/actions/workflows/rust.yml) diff --git a/src/bfloat.rs b/src/bfloat.rs index 5e4a0d3..19f1e58 100644 --- a/src/bfloat.rs +++ b/src/bfloat.rs @@ -1633,7 +1633,7 @@ mod test { assert!(nan32.is_nan() && nan32.is_sign_positive()); assert!(neg_nan32.is_nan() && neg_nan32.is_sign_negative()); - // f32/f64 NaN conversion sign is non-deterministic: https://github.com/starkat99/half-rs/issues/103 + // f32/f64 NaN conversion sign is non-deterministic: https://github.com/VoidStarKat/half-rs/issues/103 assert!(neg_nan32_from_64.is_nan()); assert!(nan32_from_64.is_nan()); assert!(nan16_from_64.is_nan()); @@ -1660,7 +1660,7 @@ mod test { assert!(nan32.is_nan() && nan32.is_sign_positive()); assert!(neg_nan32.is_nan() && neg_nan32.is_sign_negative()); - // // f32/f64 NaN conversion sign is non-deterministic: https://github.com/starkat99/half-rs/issues/103 + // // f32/f64 NaN conversion sign is non-deterministic: https://github.com/VoidStarKat/half-rs/issues/103 assert!(nan32_from_16.is_nan()); assert!(neg_nan32_from_16.is_nan()); assert!(nan64_from_16.is_nan()); diff --git a/src/binary16.rs b/src/binary16.rs index 2cd8cf5..9a24256 100644 --- a/src/binary16.rs +++ b/src/binary16.rs @@ -1754,7 +1754,7 @@ mod test { assert!(nan32.is_nan() && nan32.is_sign_positive()); assert!(neg_nan32.is_nan() && neg_nan32.is_sign_negative()); - // f32/f64 NaN conversion sign is non-deterministic: https://github.com/starkat99/half-rs/issues/103 + // f32/f64 NaN conversion sign is non-deterministic: https://github.com/VoidStarKat/half-rs/issues/103 assert!(nan32_from_64.is_nan()); assert!(neg_nan32_from_64.is_nan()); assert!(nan16_from_64.is_nan()); @@ -1781,7 +1781,7 @@ mod test { assert!(nan32.is_nan() && nan32.is_sign_positive()); assert!(neg_nan32.is_nan() && neg_nan32.is_sign_negative()); - // f32/f64 NaN conversion sign is non-deterministic: https://github.com/starkat99/half-rs/issues/103 + // f32/f64 NaN conversion sign is non-deterministic: https://github.com/VoidStarKat/half-rs/issues/103 assert!(nan32_from_16.is_nan()); assert!(neg_nan32_from_16.is_nan()); assert!(nan64_from_16.is_nan());