From ab6aa8a917b729a1d906b5677d744fe47324804e Mon Sep 17 00:00:00 2001 From: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> Date: Wed, 6 May 2026 10:24:13 +1000 Subject: [PATCH 1/3] Bump MSRV to 1.86 This was released in April 2025, which is now more than a year ago. The reason I want this now is #217, but it does also have user-facing improvements to constness. --- .github/workflows/ci.yml | 2 +- CHANGELOG.md | 6 +++++- Cargo.toml | 4 +--- README.md | 2 +- color/README.md | 2 +- color/src/flags.rs | 24 ++++-------------------- color/src/floatfuncs.rs | 12 ------------ color_operations/README.md | 2 +- 8 files changed, 14 insertions(+), 40 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 92b57f6..14d8ca1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ env: # If the compilation fails, then the version specified here needs to be bumped up to reality. # Be sure to also update the rust-version property in the workspace Cargo.toml file, # plus all the README.md files of the affected packages. - RUST_MIN_VER: "1.82" + RUST_MIN_VER: "1.86" # List of packages that will be checked with the minimum supported Rust version. # This should be limited to packages that are intended for publishing. RUST_MIN_VER_PKGS: "-p color -p color_operations" diff --git a/CHANGELOG.md b/CHANGELOG.md index 159eb09..a67ee43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,11 @@ You can find its changes [documented below](#033-2026-05-05). ## [Unreleased][] -This release has an [MSRV][] of 1.82. +This release has an [MSRV][] of 1.86. + +### Changed + +- `Flags::set_missing`, `Flags::discard_name`, `Flags::set_named_color_space`, and `Missing::insert` are now `const` thanks to the MSRV update. ([#xxx] by [@DJMcNab][]) ## [0.3.3][] (2026-05-05) diff --git a/Cargo.toml b/Cargo.toml index 46a3781..a9c020d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,9 +13,7 @@ version = "0.3.3" edition = "2021" # Keep in sync with RUST_MIN_VER in .github/workflows/ci.yml, with the relevant README.md files # and with the MSRV in the `Unreleased` section of CHANGELOG.md. -# When updating to 1.83 or later, update `color/src/flags.rs` and remove this note. -# When updating to 1.84 or later, update `color/src/floatfuncs.rs` and remove this note. -rust-version = "1.82" +rust-version = "1.86" license = "Apache-2.0 OR MIT" repository = "https://github.com/linebender/color" diff --git a/README.md b/README.md index e586bde..aef790b 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ It closely follows the [CSS Color Level 4] draft spec. ## Minimum supported Rust Version (MSRV) -This version of Color has been verified to compile with **Rust 1.82** and later. +This version of Color has been verified to compile with **Rust 1.86** and later. Future versions of Color might increase the Rust version requirement. It will not be treated as a breaking change and as such can even happen with small patch releases. diff --git a/color/README.md b/color/README.md index a13b661..028e13f 100644 --- a/color/README.md +++ b/color/README.md @@ -109,7 +109,7 @@ At least one of `std` and `libm` is required; `std` overrides `libm`. ## Minimum supported Rust Version (MSRV) -This version of Color has been verified to compile with **Rust 1.82** and later. +This version of Color has been verified to compile with **Rust 1.86** and later. Future versions of Color might increase the Rust version requirement. It will not be treated as a breaking change and as such can even happen with small patch releases. diff --git a/color/src/flags.rs b/color/src/flags.rs index dfd01d5..f11bb1b 100644 --- a/color/src/flags.rs +++ b/color/src/flags.rs @@ -56,11 +56,7 @@ impl Flags { /// Set the missing components. #[inline] - #[warn( - clippy::missing_const_for_fn, - reason = "can be made const with MSRV 1.83" - )] - pub fn set_missing(&mut self, missing: Missing) { + pub const fn set_missing(&mut self, missing: Missing) { self.missing = missing; } @@ -91,11 +87,7 @@ impl Flags { /// Set the flags to indicate the color was specified using one of the named color space /// functions. - #[warn( - clippy::missing_const_for_fn, - reason = "can be made const with MSRV 1.83" - )] - pub(crate) fn set_named_color_space(&mut self) { + pub(crate) const fn set_named_color_space(&mut self) { self.name = 255; } @@ -120,11 +112,7 @@ impl Flags { /// Discard the color name or color space name from the flags. #[inline] - #[warn( - clippy::missing_const_for_fn, - reason = "can be made const with MSRV 1.83" - )] - pub fn discard_name(&mut self) { + pub const fn discard_name(&mut self) { self.name = 0; } } @@ -159,11 +147,7 @@ impl Missing { /// Add a missing component index to the set. #[inline] - #[warn( - clippy::missing_const_for_fn, - reason = "can be made const with MSRV 1.83" - )] - pub fn insert(&mut self, ix: usize) { + pub const fn insert(&mut self, ix: usize) { self.0 |= Self::single(ix).0; } diff --git a/color/src/floatfuncs.rs b/color/src/floatfuncs.rs index b9986be..4ba4bf1 100644 --- a/color/src/floatfuncs.rs +++ b/color/src/floatfuncs.rs @@ -1,14 +1,6 @@ // Copyright 2024 the Color Authors // SPDX-License-Identifier: Apache-2.0 OR MIT -// In Rust 1.84 (https://github.com/rust-lang/rust/pull/131304), `abs` and -// `copysign` were added to `core`, so we no longer need these forwarded to -// libm. -#![cfg_attr( - not(feature = "std"), - expect(dead_code, reason = "abs and copysign were added to core in 1.84") -)] - //! Shims for math functions that ordinarily come from std. /// Defines a trait that chooses between libstd or libm implementations of float methods. @@ -43,13 +35,9 @@ macro_rules! define_float_funcs { } define_float_funcs! { - // This is not needed once the MSRV is 1.84 or later. - fn abs(self) -> Self => fabsf; fn atan2(self, other: Self) -> Self => atan2f; fn cbrt(self) -> Self => cbrtf; fn ceil(self) -> Self => ceilf; - // This is not needed once the MSRV is 1.84 or later. - fn copysign(self, sign: Self) -> Self => copysignf; fn floor(self) -> Self => floorf; fn hypot(self, other: Self) -> Self => hypotf; // Note: powi is missing because its libm implementation is not efficient diff --git a/color_operations/README.md b/color_operations/README.md index c4645a1..df9cd9f 100644 --- a/color_operations/README.md +++ b/color_operations/README.md @@ -17,7 +17,7 @@ The Color Operations library provides functionality for ... ## Minimum supported Rust Version (MSRV) -This version of Color Operations has been verified to compile with **Rust 1.82** and later. +This version of Color Operations has been verified to compile with **Rust 1.86** and later. Future versions of Color Operations might increase the Rust version requirement. It will not be treated as a breaking change and as such can even happen with small patch releases. From 05a498bdb2d4d090316e124ce933c4247ede4658 Mon Sep 17 00:00:00 2001 From: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> Date: Wed, 6 May 2026 10:32:43 +1000 Subject: [PATCH 2/3] Fix changelog number --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a67ee43..c92343d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ This release has an [MSRV][] of 1.86. ### Changed -- `Flags::set_missing`, `Flags::discard_name`, `Flags::set_named_color_space`, and `Missing::insert` are now `const` thanks to the MSRV update. ([#xxx] by [@DJMcNab][]) +- `Flags::set_missing`, `Flags::discard_name`, `Flags::set_named_color_space`, and `Missing::insert` are now `const` thanks to the MSRV update. ([#218][] by [@DJMcNab][]) ## [0.3.3][] (2026-05-05) @@ -230,6 +230,7 @@ This is the initial release. [#202]: https://github.com/linebender/color/pull/202 [#210]: https://github.com/linebender/color/pull/210 [#211]: https://github.com/linebender/color/pull/211 +[#218]: https://github.com/linebender/color/pull/218 [Unreleased]: https://github.com/linebender/color/compare/v0.3.3...HEAD [0.3.3]: https://github.com/linebender/color/releases/tag/v0.3.3 From feb550c1da80a576a65814c6a5794a10d1d8f125 Mon Sep 17 00:00:00 2001 From: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> Date: Wed, 6 May 2026 10:36:20 +1000 Subject: [PATCH 3/3] Also remove `round` as it's unused (Presumably as-of https://github.com/linebender/color/pull/166?) --- color/src/floatfuncs.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/color/src/floatfuncs.rs b/color/src/floatfuncs.rs index 4ba4bf1..4f7655e 100644 --- a/color/src/floatfuncs.rs +++ b/color/src/floatfuncs.rs @@ -42,7 +42,6 @@ define_float_funcs! { fn hypot(self, other: Self) -> Self => hypotf; // Note: powi is missing because its libm implementation is not efficient fn powf(self, n: Self) -> Self => powf; - fn round(self) -> Self => roundf; fn sin_cos(self) -> (Self, Self) => sincosf; fn sqrt(self) -> Self => sqrtf; }