Skip to content

Fix minver and msrv CI: bump cfg_aliases floor and MSRV to 1.70 - #2812

Open
jzuber4 wants to merge 3 commits into
nix-rust:masterfrom
jzuber4:fix-ci-minver-msrv
Open

Fix minver and msrv CI: bump cfg_aliases floor and MSRV to 1.70#2812
jzuber4 wants to merge 3 commits into
nix-rust:masterfrom
jzuber4:fix-ci-minver-msrv

Conversation

@jzuber4

@jzuber4 jzuber4 commented Aug 13, 2026

Copy link
Copy Markdown

What does this PR do

Repairs the minver and msrv CI jobs, which are currently red on master.
These are two small, related build-hygiene fixes; they are in one PR because
neither can demonstrate green CI alone — msrv is gated on minver
(needs: minver), so both are required before the msrv job can run and pass.

1. Raise the minimum cfg_aliases build-dependency to 0.2.2.
build.rs invokes the cfg_aliases! macro. Under cargo -Zdirect-minimal-versions
cargo pins the declared floor (0.2.1), whose macro expansion contains a trailing
semicolon in expression position that current Rust rejects as a hard error, so
the build script fails to compile and minver is red. cfg_aliases 0.2.2
restructured the macro to remove it. cfg_aliases is a build-dependency only,
edition 2018, no dependencies, no MSRV bump — no effect on consumers.

2. Raise the MSRV from 1.69 to 1.70.
nix invokes bitflags! through its own libc_bitflags!. The current bitflags
2.13 release line emits macro code that triggers a name-resolver ICE in rustc
1.69.0 (`ModuleData::def_id` is called on a block module), fixed in rustc
1.70.0. Because nix commits no Cargo.lock and its resolver is not rust-version
aware, the msrv job resolves the newest bitflags and fails to build on 1.69.
1.70.0 is the lowest toolchain on which the current dependency set compiles
(verified locally: 1.69.0 ICEs, 1.70.0 builds clean).

Per the MSRV policy in the README, this implies the next release should be a
minor version bump; I've left the crate version for the maintainers to set at
release time.

Supersedes #2811 (which contained only the cfg_aliases fix; folding the MSRV
bump in lets CI go fully green).

Checklist:

  • I have read CONTRIBUTING.md
  • I have written necessary tests and rustdoc comments
  • A change log has been added if this PR modifies nix's API

nix's build script invokes the `cfg_aliases!` macro. Under
`cargo -Zdirect-minimal-versions`, cargo pins the declared floor
(0.2.1), whose macro expansion ends in a trailing semicolon in
expression position. Current Rust treats that as a hard error, so
the build script fails to compile and the `minver` CI job breaks.

cfg_aliases 0.2.2 restructured the macro to drop the trailing
semicolon. Raising the floor to 0.2.2 makes the minimum-versions
build compile. cfg_aliases is a build-dependency only (not part of
nix's public API), edition 2018, with no dependencies and no MSRV
bump, so nix's consumers and MSRV are unaffected.
nix invokes the `bitflags!` macro through its own `libc_bitflags!`. The
current bitflags 2.13 release line emits macro code that triggers a
name-resolver ICE in rustc 1.69.0 (`ModuleData::def_id is called on a
block module`), which is fixed in rustc 1.70.0. nix commits no
Cargo.lock and its resolver is not rust-version aware, so the MSRV CI
job resolves the newest bitflags and fails to build on the current MSRV
of 1.69.

1.70.0 is the lowest toolchain on which the current dependency set
compiles (verified locally: 1.69.0 ICEs, 1.70.0 builds clean). Update
rust-version, the CI MSRV, and the README badge and prose to match.
Raising the MSRV to 1.70 enables `clippy::unnecessary_map_or`, which
flags `Result::map_or(false, f)`. `Result::is_ok_and` (stabilized in
Rust 1.70) expresses the same check and satisfies the lint.
@maxlapshin

Copy link
Copy Markdown

It would be nice to accept it. My PR is red because of the same problems.

@xtqqczze

Copy link
Copy Markdown
Contributor

I don't think we should bump the MSRV for this; it would be better if the msrv job used direct-minimal-versions.

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.

3 participants