Skip to content

Conversation

@kkysen
Copy link
Contributor

@kkysen kkysen commented Oct 19, 2025

I think this was probably a typo in the Cargo.toml.hbs template. The ~ means strip trailing whitespace, causing us to emit things like c2rust-bitfields= "0.3" instead of c2rust-bitfields = "0.3", which is what c2rust-testsuite matches on:

https://github.com/immunant/c2rust-testsuite/blob/5b5a098a39d5431383f46410b838e24321a4cb25/tests/templates.py#L31-L32

    sed --in-place --regexp-extended "s|c2rust-bitfields = \"([0-9.]+)\"|c2rust-bitfields = { version = \"\1\", path = \"$C2RUST_DIR/c2rust-bitfields\" }|" "$SCRIPT_DIR/repo/Cargo.toml"
    sed --in-place --regexp-extended "s|c2rust-asm-casts = \"([0-9.]+)\"|c2rust-asm-casts = { version = \"\1\", path = \"$C2RUST_DIR/c2rust-asm-casts\" }|" "$SCRIPT_DIR/repo/Cargo.toml"

kkysen added a commit that referenced this pull request Oct 20, 2025
…t 1.65

Our workspace `Cargo.toml` uses workspace inheritance,
which was stabilized in Rust 1.64, so is fine with our pinned nightly of Rust 1.65.
But `c2rust-refactor` was using `cargo v0.62` (corresponding to Rust 1.62),
so when `c2rust-refactor` was run on a `Cargo.toml`
that referenced `c2rust-bitfields` with a relative path to our repo, it broke on this
(which #1419 and #1420 fix/enable).

Thus, we need to update to at least `cargo v0.64`, and preferably `v0.65`.
`cargo v0.65` depends on `toml_edit v0.14.3`, which depends on `kstring v2.0.0`.
By default, `kstring v2.0.1` is selected (since Rust 1.65 doesn't support the MSRV-aware resolver),
but it has an MSRV of Rust 1.73, too new.
Luckily, though, `kstring v2.0.0` has an MSRV of Rust 1.59, so we pin it.
kkysen added a commit that referenced this pull request Oct 20, 2025
…t 1.65

Our workspace `Cargo.toml` uses workspace inheritance,
which was stabilized in Rust 1.64, so is fine with our pinned nightly of Rust 1.65.
But `c2rust-refactor` was using `cargo v0.62` (corresponding to Rust 1.62),
so when `c2rust-refactor` was run on a `Cargo.toml`
that referenced `c2rust-bitfields` with a relative path to our repo, it broke on this
(which #1419 and #1420 fix/enable).

Thus, we need to update to at least `cargo v0.64`, and preferably `v0.65`.
`cargo v0.65` depends on `toml_edit v0.14.3`, which depends on `kstring v2.0.0`.
By default, `kstring v2.0.1` is selected (since Rust 1.65 doesn't support the MSRV-aware resolver),
but it has an MSRV of Rust 1.73, too new.
Luckily, though, `kstring v2.0.0` has an MSRV of Rust 1.59, so we pin it.
`cargo-util` is then also updated to match `cargo v0.65`'s dependency.
kkysen added a commit that referenced this pull request Oct 20, 2025
…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 added a commit that referenced this pull request Oct 20, 2025
…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 added a commit that referenced this pull request Oct 20, 2025
…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/fix-stripped-whitespace-in-generated-Cargo.toml branch from 8380b74 to 0da8fb7 Compare October 20, 2025 21:28
@kkysen kkysen changed the base branch from master to kkysen/update-generated-rust-version October 20, 2025 21:28
kkysen added a commit that referenced this pull request Oct 23, 2025
…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
@kkysen kkysen force-pushed the kkysen/fix-stripped-whitespace-in-generated-Cargo.toml branch from 0da8fb7 to 844fa4e Compare October 23, 2025 05:33
@kkysen kkysen changed the base branch from kkysen/update-generated-rust-version to kkysen/ci-fix-test_translator-syn-v2 October 23, 2025 05:34
kkysen added a commit that referenced this pull request Oct 23, 2025
…t 1.65

Our workspace `Cargo.toml` uses workspace inheritance,
which was stabilized in Rust 1.64, so is fine with our pinned nightly of Rust 1.65.
But `c2rust-refactor` was using `cargo v0.62` (corresponding to Rust 1.62),
so when `c2rust-refactor` was run on a `Cargo.toml`
that referenced `c2rust-bitfields` with a relative path to our repo, it broke on this
(which #1419 and #1420 fix/enable).

Thus, we need to update to at least `cargo v0.64`, and preferably `v0.65`.
`cargo v0.65` depends on `toml_edit v0.14.3`, which depends on `kstring v2.0.0`.
By default, `kstring v2.0.1` is selected (since Rust 1.65 doesn't support the MSRV-aware resolver),
but it has an MSRV of Rust 1.73, too new.
Luckily, though, `kstring v2.0.0` has an MSRV of Rust 1.59, so we pin it.
`cargo-util` is then also updated to match `cargo v0.65`'s dependency.
@kkysen kkysen force-pushed the kkysen/fix-stripped-whitespace-in-generated-Cargo.toml branch from 844fa4e to a33d486 Compare October 23, 2025 06:08
@kkysen kkysen changed the base branch from kkysen/ci-fix-test_translator-syn-v2 to kkysen/refactor-cargo-v0.65 October 23, 2025 06:09
kkysen added a commit that referenced this pull request Oct 23, 2025
…t 1.65

Our workspace `Cargo.toml` uses workspace inheritance,
which was stabilized in Rust 1.64, so is fine with our pinned nightly of Rust 1.65.
But `c2rust-refactor` was using `cargo v0.62` (corresponding to Rust 1.62),
so when `c2rust-refactor` was run on a `Cargo.toml`
that referenced `c2rust-bitfields` with a relative path to our repo, it broke on this
(which #1419 and #1420 fix/enable).

Thus, we need to update to at least `cargo v0.64`, and preferably `v0.65`.
`cargo v0.65` depends on `toml_edit v0.14.3`, which depends on `kstring v2.0.0`.
By default, `kstring v2.0.1` is selected (since Rust 1.65 doesn't support the MSRV-aware resolver),
but it has an MSRV of Rust 1.73, too new.
Luckily, though, `kstring v2.0.0` has an MSRV of Rust 1.59, so we pin it.
`cargo-util` is then also updated to match `cargo v0.65`'s dependency.
@kkysen kkysen force-pushed the kkysen/refactor-cargo-v0.65 branch from 420523f to 236bc08 Compare October 23, 2025 07:01
@kkysen kkysen force-pushed the kkysen/fix-stripped-whitespace-in-generated-Cargo.toml branch from a33d486 to 424a034 Compare October 23, 2025 07:02
kkysen added a commit that referenced this pull request Oct 23, 2025
…t 1.65

Our workspace `Cargo.toml` uses workspace inheritance,
which was stabilized in Rust 1.64, so is fine with our pinned nightly of Rust 1.65.
But `c2rust-refactor` was using `cargo v0.62` (corresponding to Rust 1.62),
so when `c2rust-refactor` was run on a `Cargo.toml`
that referenced `c2rust-bitfields` with a relative path to our repo, it broke on this
(which #1419 and #1420 fix/enable).

Thus, we need to update to at least `cargo v0.64`, and preferably `v0.65`.
`cargo v0.65` depends on `toml_edit v0.14.3`, which depends on `kstring v2.0.0`.
By default, `kstring v2.0.1` is selected (since Rust 1.65 doesn't support the MSRV-aware resolver),
but it has an MSRV of Rust 1.73, too new.
Luckily, though, `kstring v2.0.0` has an MSRV of Rust 1.59, so we pin it.
`cargo-util` is then also updated to match `cargo v0.65`'s dependency.
@kkysen kkysen force-pushed the kkysen/refactor-cargo-v0.65 branch from 236bc08 to e9b95e6 Compare October 23, 2025 19:10
@kkysen kkysen force-pushed the kkysen/fix-stripped-whitespace-in-generated-Cargo.toml branch from 424a034 to 4ed2d74 Compare October 23, 2025 19:10
kkysen added a commit that referenced this pull request Oct 23, 2025
…for `syn v2.0.107` and `cargo`'s sparse registry (#1422)

`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 added a commit that referenced this pull request Oct 23, 2025
…t 1.65 (#1421)

Our workspace `Cargo.toml` uses workspace inheritance, which was
stabilized in Rust 1.64, so is fine with our pinned nightly of Rust
1.65. But `c2rust-refactor` was using `cargo v0.62` (corresponding to
Rust 1.62), so when `c2rust-refactor` was run on a `Cargo.toml` that
referenced `c2rust-bitfields` with a relative path to our repo, it broke
on this (which #1419 and #1420 fix/enable).

Thus, we need to update to at least `cargo v0.64`, and preferably
`v0.65`. `cargo v0.65` depends on `toml_edit v0.14.3`, which depends on
`kstring v2.0.0`. By default, `kstring v2.0.1` is selected (since Rust
1.65 doesn't support the MSRV-aware resolver), but it has an MSRV of
Rust 1.73, too new.
Luckily, though, `kstring v2.0.0` has an MSRV of Rust 1.59, so we pin
it.
Base automatically changed from kkysen/refactor-cargo-v0.65 to master October 23, 2025 19:36
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.

I have no idea why this keeps failing in CI for Ubuntu 22 on z3 due to a glibc mismatch, but not for the next PR #1420. I'm guessing some CI cache thing? I'm just going to merge this, since it should be totally unrelated and #1420 doesn't have the error.

@kkysen kkysen merged commit 73b8dcc into master Oct 23, 2025
4 of 5 checks passed
@kkysen kkysen deleted the kkysen/fix-stripped-whitespace-in-generated-Cargo.toml branch October 23, 2025 19:37
kkysen added a commit that referenced this pull request Oct 23, 2025
…of c2rust crates are used (#1420)

The `transpile.gen.sh`s generated by `c2rust-testsuite` use `C2RUST_DIR`
to set dependencies in generated `Cargo.toml`s to point to the current
`c2rust` directory, allowing it to test with the current version of
`c2rust-bitfields` and `c2rust-asm-casts`.

This needs #1419 fixed first, and it should unblock #1408, which depends
on the `c2rust-bitfields-derive` fix in #1411.
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