Skip to content

Conversation

@kkysen
Copy link
Contributor

@kkysen kkysen commented Oct 20, 2025

c2rust-bitfields-derive depends on syn v2.0. Without a Cargo.lock, like in transpiled projects (as opposed to c2rust itself), this will resolve to syn v2.0.107, which requires Rust 1.68, but the generated rust-toolchain.toml uses Rust 1.65 (the same as our own nightly). This is currently breaking CI for the c2rust-instrument tests, and will also break CI for c2rust-testsuite once #1418 lands (a bug fix).

Furthermore, the old git-based registry fetching is extremely slow in CI, so when #1227 lands and switches to stable, we also want Rust 1.70 for cargo's sparse registry. Due to stable crates now building on stable but testing their output on nightly, it is very difficult to correctly cache.
Updating the nightly of their output to the earliest to have the sparse registry should fix this.

The combination of this, #1418, #1419, #1420, and #1421 has been tested to work on libxml2:

cargo build --release
(cd ../c2rust-testsuite/tests/libxml2/repo/ &&
    $OLDPWD/target/release/c2rust-refactor --cargo --rewrite-mode inplace --lib reorganize_definitions
)

…for `syn v2.0.107` and `cargo`'s sparse registry

`c2rust-bitfields-derive` depends on `syn v2.0`.
Without a `Cargo.lock`, like in transpiled projects (as opposed to `c2rust` itself),
this will resolve to `syn v2.0.107`, which requires Rust 1.68,
but the generated `rust-toolchain.toml` uses Rust 1.65 (the same as our own nightly).
This is currently breaking CI for the `c2rust-instrument` tests,
and will also break CI for `c2rust-testsuite` once #1418 lands (a bug fix).

Furthermore, the old git-based registry fetching is extremely slow in CI,
so when #1227 lands and switches to stable, we also want Rust 1.70 for `cargo`'s sparse registry.
Due to stable crates now building on stable but testing their output on nightly,
it is very difficult to correctly cache.
Updating the nightly of their output to the earliest to have the sparse registry should fix this.

The combination of this, #1418, #1419, #1420, and #1421 has been tested to work on `libxml2`:

```sh
cargo build --release
(cd ../c2rust-testsuite/tests/libxml2/repo/ &&
    $OLDPWD/target/release/c2rust-refactor --cargo --rewrite-mode inplace --lib reorganize_definitions
)
```
@kkysen kkysen force-pushed the kkysen/update-generated-rust-version branch from 34a4213 to ad39c04 Compare October 23, 2025 05:03
Copy link
Contributor

@ahomescu ahomescu left a comment

Choose a reason for hiding this comment

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

Maybe we should hold off on this until we get c2rust-refactor in CI?

Copy link
Contributor Author

@kkysen kkysen left a comment

Choose a reason for hiding this comment

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

Maybe we should hold off on this until we get c2rust-refactor in CI?

It's running in CI already as of immunant/c2rust-testsuite#20.

@Rua
Copy link
Contributor

Rua commented Oct 23, 2025

If I understand it correctly, it means that the transpiled code will target the newer nightly, but the c2rust code itself still requires the older one to build?

@kkysen
Copy link
Contributor Author

kkysen commented Oct 23, 2025

If I understand it correctly, it means that the transpiled code will target the newer nightly, but the c2rust code itself still requires the older one to build?

Yes. Well, c2rust-transpile is still usable on stable, but yes for the other unstable c2rust code like c2rust-refactor. The latter means we don't want to emit any newly stabilized things that c2rust-refactor won't understand on the old nightly, so hopefully tests should prevent us from accidentally doing that.

@kkysen kkysen merged commit 9471e2c into master Oct 23, 2025
2 of 5 checks passed
@kkysen kkysen deleted the kkysen/update-generated-rust-version branch October 23, 2025 19:19
kkysen added a commit to kkysen/hayroll that referenced this pull request Dec 1, 2025
…3-04-15`, matching `c2rust` now

In immunant/c2rust#1422, `c2rust` updated
its generated `rust-toolchain.toml` to a newer version than Hayroll was using,
so it's easier to standardize on the newer one that's also tested upstream in Rust.
This also means we don't have to have multiple separate toolchains
when running both `c2rust transpile` and `hayroll`.
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