Summary
Raise the la-stack MSRV/toolchain baseline from Rust 1.96 to Rust 1.97.0 once Rust 1.97.0 is available on stable, then deliberately audit the new 1.97.0 bit-operation APIs for exact-arithmetic and benchmark hot paths.
This should stay focused on correctness, invariant clarity, and measured performance. The goal is not to rewrite code just because a new standard-library method exists.
Current State
Cargo.toml currently declares rust-version = "1.96".
rust-toolchain.toml currently pins channel = "1.96.0".
- The exact arithmetic implementation in
src/exact.rs already does substantial bit-level work:
- IEEE-754
f64 decomposition with mantissa/exponent extraction.
NonZeroU64 mantissa normalization via trailing-zero stripping.
- exact rational-to-
f64 conversion using denominator power-of-two checks.
BigInt bit-length and trailing-zero analysis for exact representability and rounding decisions.
- Rust 1.97.0 stabilizes primitive integer and
NonZero helpers such as bit_width, highest_one, lowest_one, isolate_highest_one, and isolate_lowest_one.
Proposed Changes
- Bump the Rust baseline to 1.97.0 in repository metadata and documentation.
- Audit
src/exact.rs, especially:
f64_decompose
bigint_exp_to_bigrational
exact_rational_to_finite_f64
bigint_exp_to_finite_f64
- exact determinant/sign helpers that operate on primitive mantissas before promotion to
BigInt
- Use Rust 1.97.0 bit helpers where they make exactness invariants clearer, remove hand-rolled bit arithmetic, or improve performance.
- Keep
num-bigint's bits() and trailing_zeros() APIs where the value is already a BigInt; do not contort code to use primitive helpers after promotion.
- Audit benchmark utilities such as
benches/common/exact.rs for small, useful NonZero* or bit-width simplifications.
- Review the remaining Rust 1.97.0 surface (
RepeatN::default, char::is_control const-stability, LoongArch feature detection, Cargo 1.97 diagnostics/CLI changes) and explicitly skip it unless it has a concrete la-stack benefit.
Acceptance Criteria
Cargo.toml, rust-toolchain.toml, README, AGENTS.md, release docs, and CI/tooling docs consistently declare Rust 1.97.0 as the MSRV/toolchain baseline.
- The PR includes a short audit note separating true Rust 1.97.0 features from already-baseline Rust 1.95/1.96 cleanup.
src/exact.rs is audited for bit_width, highest_one, lowest_one, isolate_highest_one, and isolate_lowest_one; any adoption preserves exact arithmetic semantics and has focused tests.
- Existing exact tests and proptests continue to cover D=2 through D=5 where applicable, including non-finite rejection, exact representability, overflow/unrepresentability, and rounded-vs-exact behavior.
- Exact-arithmetic benchmark evidence is captured before and after relevant changes, using
just bench-exact or a focused Criterion filter when the full suite is unnecessary.
num-bigint bit APIs remain in use where the data is already arbitrary precision; rejected primitive-helper opportunities are briefly documented in the PR notes.
- Cargo 1.97, Clippy, rustdoc, and compatibility-note changes are audited; new diagnostics are fixed or narrowly justified.
- No unsafe Rust is introduced.
- Final validation passes under Rust 1.97.0 stable:
just ci, including exact-feature checks.
- Changelog-ready release notes mention the Rust 1.97.0 MSRV bump and any exact-arithmetic bit-helper changes.
Benefits
- Keeps
la-stack aligned with the Rust toolchain baseline used by downstream geometry crates.
- Uses the new integer/
NonZero helpers where they directly express exact-arithmetic invariants.
- Gives exact-arithmetic performance work a concrete benchmark-before/after requirement.
- Preserves the v0.4.x roadmap focus on stable Rust, correctness, benchmark coverage, and release hardening without pulling in the v0.5.0
generic_const_exprs work.
Implementation Notes
- This belongs in the stable-Rust v0.4.x line, not the v0.5.0
generic_const_exprs milestone.
- Start once Rust 1.97.0 is available on stable.
- Related local code paths:
src/exact.rs, benches/exact.rs, and benches/common/exact.rs.
Summary
Raise the
la-stackMSRV/toolchain baseline from Rust 1.96 to Rust 1.97.0 once Rust 1.97.0 is available on stable, then deliberately audit the new 1.97.0 bit-operation APIs for exact-arithmetic and benchmark hot paths.This should stay focused on correctness, invariant clarity, and measured performance. The goal is not to rewrite code just because a new standard-library method exists.
Current State
Cargo.tomlcurrently declaresrust-version = "1.96".rust-toolchain.tomlcurrently pinschannel = "1.96.0".src/exact.rsalready does substantial bit-level work:f64decomposition with mantissa/exponent extraction.NonZeroU64mantissa normalization via trailing-zero stripping.f64conversion using denominator power-of-two checks.BigIntbit-length and trailing-zero analysis for exact representability and rounding decisions.NonZerohelpers such asbit_width,highest_one,lowest_one,isolate_highest_one, andisolate_lowest_one.Proposed Changes
src/exact.rs, especially:f64_decomposebigint_exp_to_bigrationalexact_rational_to_finite_f64bigint_exp_to_finite_f64BigIntnum-bigint'sbits()andtrailing_zeros()APIs where the value is already aBigInt; do not contort code to use primitive helpers after promotion.benches/common/exact.rsfor small, usefulNonZero*or bit-width simplifications.RepeatN::default,char::is_controlconst-stability, LoongArch feature detection, Cargo 1.97 diagnostics/CLI changes) and explicitly skip it unless it has a concretela-stackbenefit.Acceptance Criteria
Cargo.toml,rust-toolchain.toml, README, AGENTS.md, release docs, and CI/tooling docs consistently declare Rust 1.97.0 as the MSRV/toolchain baseline.src/exact.rsis audited forbit_width,highest_one,lowest_one,isolate_highest_one, andisolate_lowest_one; any adoption preserves exact arithmetic semantics and has focused tests.just bench-exactor a focused Criterion filter when the full suite is unnecessary.num-bigintbit APIs remain in use where the data is already arbitrary precision; rejected primitive-helper opportunities are briefly documented in the PR notes.just ci, including exact-feature checks.Benefits
la-stackaligned with the Rust toolchain baseline used by downstream geometry crates.NonZerohelpers where they directly express exact-arithmetic invariants.generic_const_exprswork.Implementation Notes
generic_const_exprsmilestone.src/exact.rs,benches/exact.rs, andbenches/common/exact.rs.