ccextractor does not build with rust 1.54.0
Documentation (and build script) says minimum rust version is 1.54 but building with that version (e.g. installing rust via apt on Debian bookworm) fails with this error:
# ./build
Running pre-build script...
Obtaining Git commit
Storing variables in file
Commit: 42d750950a79db328ff8761d0b8acc3cc0f21099
Date: 2025-11-17
Stored all in compile_info_real.h
Done.
Trying to compile...
Checking for cargo...
rustc >= MSRV(1.54.0)
Building rust files...
Compiling ccx_rust v0.1.0 (/tmp/ccextractor/src/rust)
error[E0658]: use of unstable library feature `unsigned_is_multiple_of`
--> src/es/pic.rs:253:45
|
253 | || dec_ctx.total_pulldownfields.is_multiple_of(2)
| ^^^^^^^^^^^^^^
|
= note: see issue #128101 <https://github.com/rust-lang/rust/issues/128101> for more information
For more information about this error, try `rustc --explain E0658`.
error: could not compile `ccx_rust` (lib) due to 1 previous error
Failed.
I suspect this just needs the minimum version of rust bumping up, following the integration of ebd8252b (merge request: #1753) for compatibility with 1.90.
(Also -without-rust option is not recognised by the build script and --without-rust doesn't work via the configure/make/install route, so I've not been able to workaround that way. I think that the build documentation might need a review by someone who knows how to build ccextractor.)
I'd like to work on this issue.
I’m setting up the environment and reproducing the Rust build failure locally.
The error seems to be coming from the use of is_multiple_of(), which is unstable on Rust 1.54.
I’ll investigate whether:
- we should bump the MSRV, or
- replace the unstable API with an equivalent stable check (
% 2 == 0).
Will update soon with findings and open a PR.
- replace the unstable API with an equivalent stable check (
% 2 == 0).
That commit I linked to (ebd8252 / merge request #1753) replaced % 2 == 0 check with this is_multiple_of(). The merge request title was "Fix: Rust Clippy failing on 1.90" and this was the only code change, I don't know Rust, but, from that, I infer that the %2 == 0 approach doesn't work or breaks something in Rust 1.90?
I expect, based on this, bumping the MSRV will be the only solution to not break 1.90 compatibility. But I don't know what the minimum version of Rust should be for the newer code to work.
Thanks for the context, that makes sense.
Given that is_multiple_of() was introduced specifically to satisfy Clippy on Rust 1.90, reverting to the old % 2 == 0 logic would indeed break compatibility with newer Rust releases.
In that case, the cleaner solution seems to be:
- Identify the minimum Rust version where
is_multiple_of()became stable, - Bump the MSRV accordingly in:
- the build script,
- documentation,
- and CI configuration if needed.
I'll run some quick checks across Rust versions to determine the lowest compatible one (likely around 1.71+), and then open a PR updating MSRV and related docs.
Will update soon with findings.
....just done some Googling - possibly the change needs reverting back to code that works with 1.54 and the Clippy linting (now Google's told me what it is ;) ) MSRV set to the same as this project in which case it shouldn't fail the previous code any more?: https://github.com/rust-lang/rust-clippy?tab=readme-ov-file#specifying-the-minimum-supported-rust-version
Depends on if you want to maintain supporting of the older versions of Rust? (I think in any case, Clippy needs to be configured to match the project's MSRV to avoid problems in the future.)
Edit - bit more research and it seems is_multiple_of() was added (as stable) in 1.90.0: https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_multiple_of
cool, thanks for running those checks, that clarifies things.!
Given that the build script explicitly checks for MSRV(1.54.0), it makes sense to maintain compatibility with 1.54 rather than rely on an unstable feature from newer Rust versions.
Using is_multiple_of() to satisfy a Clippy lint seems to be the root cause, so the safer and more consistent approach is likely:
- Reverting that line back to the stable % 2 == 0 logic, and
- Adding a Clippy MSRV configuration (clippy.toml or equivalent) so that Clippy lints against the project's supported MSRV instead of the toolchain's.
This should fix the build failure while preventing similar issues in the future. I'll test this approach locally and verify that:
- Rust 1.54 builds cleanly,
- Clippy (with MSRV configured) no longer suggests the unstable API,
- Newer Rust versions still pass CI.
If everything checks out, I’ll open a PR with the fix and configuration update.