From caaa733caae08a683d5151c6973d11a533796c5b Mon Sep 17 00:00:00 2001 From: iris <2+iris@noreply.localhost> Date: Fri, 4 Sep 2026 17:47:27 -0400 Subject: [PATCH] Make iris build: pin a dated nightly and migrate const-trait impls The vendored January tree did not parse at all on a current nightly: 36 errors in iris-core, all from one syntax change. `impl const Trait for T` is now `const impl Trait for T`, with generics on the `impl`. Bounds are unaffected, and the traits were already declared `const trait` -- so the diagnosis recorded in RUST.md was wrong, and pinning back to a January nightly would only have deferred this. Everything else (the unresolved UiVec2/Vec2/impl_op imports, a Color resolving to wgpu_types::Color) cascaded from the seven files that failed to parse. The pin is dated rather than `nightly` because that is exactly the failure: a rolling channel moving under a build Dev Updater runs unattended. It carries the components and Android targets too, so a fresh clone provisions itself. Also drops two `#![feature]` gates the compiler reports as declared and unused, since the build stays warning-clean, and takes rustfmt's import order in attr.rs. Co-Authored-By: Claude Opus 5 --- iris/core/src/attr.rs | 2 +- iris/core/src/lib.rs | 2 -- iris/core/src/num.rs | 10 +++++----- iris/core/src/orientation/align.rs | 2 +- iris/core/src/orientation/axis.rs | 4 ++-- iris/core/src/orientation/pos.rs | 4 ++-- iris/core/src/primitive/color.rs | 4 ++-- iris/core/src/util/math.rs | 17 +++++++++-------- iris/core/src/util/vec2.rs | 2 +- iris/rust-toolchain.toml | 11 +++++++++++ 10 files changed, 34 insertions(+), 24 deletions(-) create mode 100644 iris/rust-toolchain.toml diff --git a/iris/core/src/attr.rs b/iris/core/src/attr.rs index 6d0a28e..e03fb9d 100644 --- a/iris/core/src/attr.rs +++ b/iris/core/src/attr.rs @@ -1,4 +1,4 @@ -use crate::{UiRsc, WidgetIdFn, WidgetLike, WeakWidget}; +use crate::{UiRsc, WeakWidget, WidgetIdFn, WidgetLike}; pub trait WidgetAttr { type Input; diff --git a/iris/core/src/lib.rs b/iris/core/src/lib.rs index f60415a..21882d9 100644 --- a/iris/core/src/lib.rs +++ b/iris/core/src/lib.rs @@ -2,10 +2,8 @@ #![feature(const_ops)] #![feature(const_trait_impl)] #![feature(const_convert)] -#![feature(map_try_insert)] #![feature(unboxed_closures)] #![feature(fn_traits)] -#![feature(const_cmp)] #![feature(const_destruct)] #![feature(portable_simd)] #![feature(associated_type_defaults)] diff --git a/iris/core/src/num.rs b/iris/core/src/num.rs index c4ad5cd..bcd3a08 100644 --- a/iris/core/src/num.rs +++ b/iris/core/src/num.rs @@ -5,19 +5,19 @@ pub const trait UiNum { fn to_f32(self) -> f32; } -impl const UiNum for f32 { +const impl UiNum for f32 { fn to_f32(self) -> f32 { self } } -impl const UiNum for u32 { +const impl UiNum for u32 { fn to_f32(self) -> f32 { self as f32 } } -impl const UiNum for i32 { +const impl UiNum for i32 { fn to_f32(self) -> f32 { self as f32 } @@ -27,7 +27,7 @@ pub const fn vec2(x: impl const UiNum, y: impl const UiNum) -> Vec2 { Vec2::new(x.to_f32(), y.to_f32()) } -impl const From for Vec2 { +const impl From for Vec2 { fn from(v: T) -> Self { Self { x: v.to_f32(), @@ -36,7 +36,7 @@ impl const From for Vec2 { } } -impl const From<(T, U)> for Vec2 +const impl From<(T, U)> for Vec2 where (T, U): const Destruct, { diff --git a/iris/core/src/orientation/align.rs b/iris/core/src/orientation/align.rs index 4fe79d2..876208a 100644 --- a/iris/core/src/orientation/align.rs +++ b/iris/core/src/orientation/align.rs @@ -187,7 +187,7 @@ impl From for Align { } } -impl const From for UiVec2 { +const impl From for UiVec2 { fn from(align: RegionAlign) -> Self { Self::rel(align.rel()) } diff --git a/iris/core/src/orientation/axis.rs b/iris/core/src/orientation/axis.rs index 0f31958..997036a 100644 --- a/iris/core/src/orientation/axis.rs +++ b/iris/core/src/orientation/axis.rs @@ -74,14 +74,14 @@ pub const trait AxisT { } pub struct XAxis; -impl const AxisT for XAxis { +const impl AxisT for XAxis { fn get() -> Axis { Axis::X } } pub struct YAxis; -impl const AxisT for YAxis { +const impl AxisT for YAxis { fn get() -> Axis { Axis::Y } diff --git a/iris/core/src/orientation/pos.rs b/iris/core/src/orientation/pos.rs index 204e048..ae0cbc5 100644 --- a/iris/core/src/orientation/pos.rs +++ b/iris/core/src/orientation/pos.rs @@ -124,13 +124,13 @@ impl Display for UiVec2 { impl_op!(UiVec2 Add add; x y); impl_op!(UiVec2 Sub sub; x y); -impl const From for UiVec2 { +const impl From for UiVec2 { fn from(abs: Vec2) -> Self { Self::abs(abs) } } -impl const From<(T, U)> for UiVec2 +const impl From<(T, U)> for UiVec2 where (T, U): const Destruct, { diff --git a/iris/core/src/primitive/color.rs b/iris/core/src/primitive/color.rs index 1681c2b..fc27f1e 100644 --- a/iris/core/src/primitive/color.rs +++ b/iris/core/src/primitive/color.rs @@ -144,7 +144,7 @@ impl ColorNum for f32 { unsafe impl bytemuck::Pod for Color {} -impl const F32Conversion for f32 { +const impl F32Conversion for f32 { fn to(self) -> f32 { self } @@ -153,7 +153,7 @@ impl const F32Conversion for f32 { } } -impl const F32Conversion for u8 { +const impl F32Conversion for u8 { fn to(self) -> f32 { self as f32 / 255.0 } diff --git a/iris/core/src/util/math.rs b/iris/core/src/util/math.rs index 4bcdbce..4bf4f3a 100644 --- a/iris/core/src/util/math.rs +++ b/iris/core/src/util/math.rs @@ -9,15 +9,16 @@ pub const trait DivOr { fn div_or(self, rhs: Self, other: Self) -> Self; } -impl const DivOr for f32 { +const impl DivOr for f32 { fn div_or(self, rhs: Self, other: Self) -> Self { let res = self / rhs; if res.is_nan() { other } else { res } } } -impl + const Sub + const Mul + const DivOr + Copy> const - LerpUtil for T +const impl< + T: const Add + const Sub + const Mul + const DivOr + Copy, +> LerpUtil for T { /// linear interpolation /// from * (1.0 - self) + to * self @@ -37,7 +38,7 @@ macro_rules! impl_op { use super::*; #[allow(unused_imports)] use std::ops::*; - impl const $op for $T { + const impl $op for $T { type Output = Self; fn $fn(self, rhs: Self) -> Self::Output { @@ -46,12 +47,12 @@ macro_rules! impl_op { } } } - impl const $opa for $T { + const impl $opa for $T { fn $fna(&mut self, rhs: Self) { *self = self.$fn(rhs); } } - impl const $op for $T { + const impl $op for $T { type Output = Self; fn $fn(self, rhs: f32) -> Self::Output { @@ -60,7 +61,7 @@ macro_rules! impl_op { } } } - impl const $op<$T> for f32 { + const impl $op<$T> for f32 { type Output = $T; fn $fn(self, rhs: $T) -> Self::Output { @@ -69,7 +70,7 @@ macro_rules! impl_op { } } } - impl const $opa for $T { + const impl $opa for $T { fn $fna(&mut self, rhs: f32) { *self = self.$fn(rhs); } diff --git a/iris/core/src/util/vec2.rs b/iris/core/src/util/vec2.rs index 7609861..ca67c68 100644 --- a/iris/core/src/util/vec2.rs +++ b/iris/core/src/util/vec2.rs @@ -67,7 +67,7 @@ impl_op!(Vec2 Sub sub; x y); impl_op!(Vec2 Mul mul; x y); impl_op!(Vec2 Div div; x y); -impl const DivOr for Vec2 { +const impl DivOr for Vec2 { fn div_or(self, rhs: Self, other: Self) -> Self { Self { x: self.x.div_or(rhs.x, other.x), diff --git a/iris/rust-toolchain.toml b/iris/rust-toolchain.toml new file mode 100644 index 0000000..7fd6ab2 --- /dev/null +++ b/iris/rust-toolchain.toml @@ -0,0 +1,11 @@ +# iris needs nightly (see the #![feature] list in core/src/lib.rs and src/lib.rs). +# The pin is dated rather than "nightly" because the const-traits feature set +# changes shape between nightlies: on 2026-09-04 the vendored January tree would +# not parse at all, because `impl const Trait for T` had become +# `const impl Trait for T`. A rolling channel turns that into a build that +# breaks unattended on whatever machine Dev Updater happens to build on. +# Advance this deliberately, with the feature list in RUST.md's I0b. +[toolchain] +channel = "nightly-2026-09-03" +components = ["clippy", "rustfmt"] +targets = ["aarch64-linux-android", "x86_64-linux-android"]