Skip to content

Get CI working - #63

Merged
cmpute merged 11 commits into
cmpute:masterfrom
DRMacIver:ci-fix
May 31, 2026
Merged

Get CI working#63
cmpute merged 11 commits into
cmpute:masterfrom
DRMacIver:ci-fix

Conversation

@DRMacIver

Copy link
Copy Markdown
Contributor

This is almost entirely AI generated work, but I've relatively carefully sanity checked it. Please feel free to pick and choose from it as you wish (it's well factored into commits with each individual change), and I will not be even slightly offended if you want to throw it all away.

A lot of it is just fixing lint failures, which required a lot of threading through lifetimes.

Notable decisions that you might reasonably disagree with:

  1. I dropped a bunch of dead code (entirely todo schoenhagen.rs, PrimitiveUnsigned::MAX)
  2. I bumped MSRV to 1.73. A lot of the lint failures were about features that were not supported on older rust, and I figured that this was still an older version.
  3. I removed a lot of dependencies from the MSRV CI job, because most of them no longer supported anything back as far as 1.73, and I got tired of playing whackamole figuring those out. If you're keen on keeping that in, happy to revisit.

There's also a genuine bugfix in here (words_to_chunks would panic on 32-bit targets).

DRMacIver and others added 8 commits May 30, 2026 20:13
This file was added as a placeholder for a future NTT multiplication
implementation but has been all-`todo!()` with no callers since it
landed. Under `-D warnings` on stable Rust its eight `dead_code` /
`unused_variables` errors fail CI. The CHANGELOG entry that flagged
the experimental NTT skeleton stays as historical context; the
follow-up can re-add this file (or a different scaffold) at that
point.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This associated constant on the internal `PrimitiveUnsigned` trait was
declared and implemented for every primitive but never read. Stable
clippy's `dead_code` lint flags it under the `-D warnings` CI setting.

Drop the constant entirely rather than `#[allow(dead_code)]`-suppressing
it; the trait is `pub(crate)`, so this is internal cleanup only.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The word-aligned shortcut in `convert::words_to_chunks` computes
`end_pos = start_pos + words_per_chunk` without clamping to
`words.len()`, so the last chunk panics when the input doesn't fill
exactly `words_per_chunk * chunks` source words.

Reproduces on `i686-unknown-linux-gnu` (the `Test x86` CI job) for
inputs like `0xffffffff000000001`: that value's bit length is 68, so
on a 32-bit `Word` target it's 3 source words but `to_chunks(64)`
requests `words_per_chunk = 2`. The second chunk's iteration computes
`start_pos = 2`, `end_pos = 4`, and `words[2..4]` then panics with
`range end index 4 out of range for slice of length 3`.

The caller pre-zeroes each chunk's buffer (`Buffer::push_zeros`), so
clamping the read and leaving the rest untouched produces the correct
value — the trailing zeros get stripped by `Repr::from_buffer`'s
`pop_zeros`. The 64-bit and 16-bit jobs stayed green because the same
input fits in fewer source words there and the indexing happens to
stay in bounds. (Drive-by: rustfmt reflow on the adjacent
`buffers.into_iter()...collect()` chain.)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The `test-x86`, `test-no-std`, and `build-aarch64` jobs already pass
`--exclude dashu-python`; the `test`, `test-x86_64`, and `clippy` jobs
were missing it. pyo3 0.20.3's `pymethods` macro now triggers the
`non_local_definitions` lint on stable rustc, which fails `-D warnings`
on those three jobs. Add the exclude consistently.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The 1.61/1.64 matrix branches no longer build: dependency updates have
moved several transitive dependencies (digest, ryu, serde_json, quote,
thiserror, postgres-types, diesel) past those MSRVs. Newer minimal
versions cascade unrecoverably without an MSRV-aware resolver, which
itself needs cargo 1.84 — too new to commit to as a baseline yet.

Bump MSRV to 1.73 (still over two years old) and exercise just one
older toolchain in the matrix. The postgres-types/diesel optional
features in `dashu-float` still pull deps that need 1.85+ via
edition = "2024", so the MSRV branch strips those features at check
time. Stable builds continue to compile them via --all-features.

The pre-existing `change_version.patch` (which pinned a specific old
`diesel_v2`) is no longer needed and is removed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The test matrix exercises the alternative `Word` widths (16/32/64) by
setting `RUSTFLAGS=--cfg force_bits=N`. Rust 1.80 enabled the
`unexpected_cfgs` lint by default, so the three `#[cfg(force_bits =
"...")]` sites in `integer/src/arch/mod.rs` need an explicit
`cargo:rustc-check-cfg=` declaration to keep `-D warnings` happy on
stable.

The directive is silently ignored by cargo < 1.80, which is fine —
the lint it would suppress doesn't exist on those toolchains either.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`_addcarry_u32` / `_addcarry_u64` / `_subborrow_*` were declared
`unsafe fn` until Rust 1.81, which made them safe. The `unsafe` block
is retained so the MSRV (1.73) build still compiles, and the
`unused_unsafe` lint is suppressed so post-1.81 builds don't fail
under `-D warnings`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mechanical cleanup to keep `-D warnings` clean on current stable:

- `mismatched_lifetime_syntaxes`: add explicit `'_` on elided
  references in `fmt/`, `memory.rs`, `modular/`, `repr.rs`.
- `needless_lifetimes`: drop unnecessary `'l`/`'r`/`'a` on impl blocks
  in `float/src/{add,div,mul}.rs` and `integer/src/div_const.rs`.
- `needless_borrows_for_generic_args`: drop `&` on array literals
  passed to `.rfind()` in `float/src/parse.rs`.
- `manual_div_ceil`: switch hand-rolled `(a + b - 1) / b` to
  `Int::div_ceil` in float/{fbig,round} and integer mul/root helpers
  and `macros/src/parse/common.rs`.
- `missing_transmute_annotations`: turbofish `transmute::<From, To>`
  in `convert.rs` and `repr.rs`.
- `doc_overindented_list_items`: reflow doc list indentation in
  `repr.rs`.
- `dead_code`: allow on the now-unused `IBig`/`UBig` constants in
  `integer/tests/sign.rs`.
- `double_neg` was renamed to the rustc `double_negations` lint;
  update the `#[allow(...)]` accordingly in `integer/tests/sign.rs`.

Also includes the `transmute` annotation fix in `integer/src/convert.rs`
(separated from the earlier `words_to_chunks` bug fix).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cmpute

cmpute commented May 31, 2026

Copy link
Copy Markdown
Owner

Thanks a lot for your kind help! I managed to get the MSRV back to 1.68, which is more pleasing to me. A lot of the CI issues are coming from the benchmark crate, which I will exclude from the whole CI later.

@cmpute
cmpute merged commit fc6674a into cmpute:master May 31, 2026
10 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants