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

@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.

@asomers

asomers commented Sep 8, 2026

Copy link
Copy Markdown
Member

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

Sort of true. MSRV really just means that "some combination of dependencies will compile using this compiler". But it's not necessarily the direct-minimal-versions. For other projects, I've committed a "Cargo.lock.msrv" file just for this purpose. But Rust 1.70.0 is already more than 3 years old. I feel comfortable raising the MSRV that far. It's less effort for maintainers than dealing with a Cargo.lock.msrv file.

Comment thread changelog/2812.fixed.md Outdated
Comment on lines +1 to +2
Raised the minimum `cfg_aliases` build-dependency to 0.2.2, which is required to
build nix's build script under `cargo -Zdirect-minimal-versions` on current Rust.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not technically true. It's required to build Nix with -Zdirect-minimal-versions while also denying all warnings. Consumers won't generally do that. I think you should remove this changelog entry, because it isn't really something that consumers need to care about. It's really just to make CI work.

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.
@jzuber4

jzuber4 commented Sep 9, 2026

Copy link
Copy Markdown
Author

Thanks Alan. I've updated the PR to remove the changelog. Note that the red CI appears to be related to rust-nightly rustfmt changes. Also the macos test appears flaky.

@asomers

asomers commented Sep 9, 2026

Copy link
Copy Markdown
Member

The doc failures should be fixed by #2818 .

@xtqqczze

xtqqczze commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

`ModuleData::def_id` is called on a block module

This appears to be related to rust-lang/rust#110848, where rustc 1.69.0 panics while resolving rustdoc links.

@xtqqczze

xtqqczze commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

I can reproduce the resolve_rustdoc_path ICE locally with:

cargo update -p bitflags@2 --precise 2.12.1

but not with:

cargo update -p bitflags@2 --precise 2.12.0

The ICE first occurs when the bitflags package is patched with bitflags/bitflags@e4ed635 (bitflags/bitflags#487)

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.

4 participants