Skip to content

Update cargo_toml to 0.22.1 and toml to 0.9#3914

Merged
UebelAndre merged 4 commits intobazelbuild:mainfrom
mrkkrp:mrkkrp/update-cargo-toml-origin-main
Mar 29, 2026
Merged

Update cargo_toml to 0.22.1 and toml to 0.9#3914
UebelAndre merged 4 commits intobazelbuild:mainfrom
mrkkrp:mrkkrp/update-cargo-toml-origin-main

Conversation

@mrkkrp
Copy link
Copy Markdown
Contributor

@mrkkrp mrkkrp commented Mar 23, 2026

The code in src/splicing.rs uses toml::Value types that were incompatible—the workspace used toml 0.8.x but cargo_toml 0.22.3 depends on toml 0.9.x, creating a type mismatch. Therefore, Cargo.toml was updated to use to use toml = "0.9" instead of "0.8.21".

Close #3721.

Copy link
Copy Markdown
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

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

Thank you!

@mrkkrp
Copy link
Copy Markdown
Contributor Author

mrkkrp commented Mar 24, 2026

@UebelAndre I see some of the buildkite jobs are failing. I guess this is not normal, right? It is not too obvious what the problem is though, my local bazel test run succeeds (running in a docker container with Ubuntu 24.04). Should I look more into these failures and if yes how I can get access to the test logs?

@UebelAndre
Copy link
Copy Markdown
Collaborator

@UebelAndre I see some of the buildkite jobs are failing. I guess this is not normal, right? It is not too obvious what the problem is though, my local bazel test run succeeds (running in a docker container with Ubuntu 24.04). Should I look more into these failures and if yes how I can get access to the test logs?

Looking at https://buildkite.com/bazel/rules-rust-rustlang/builds/16650/steps/canvas?sid=019d1bd2-60cb-4a17-807b-ccfc84b09afd&tab=artifacts

This seems legit

---- lockfile::test::digest_stable_with_crlf_cargo_config stdout ----

thread 'lockfile::test::digest_stable_with_crlf_cargo_config' (48) panicked at crate_universe/src/lockfile.rs:402:10:
called `Result::unwrap()` on an `Err` value: Error("TOML parse error at line 1, column 25\n  |\n1 | [registries.my-registry]\r\n  |                         ^\nunexpected content, expected nothing\n", line: 1, column: 85)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    lockfile::test::digest_stable_with_crlf_cargo_config

You should be able to get logs from each failed job

@mrkkrp mrkkrp force-pushed the mrkkrp/update-cargo-toml-origin-main branch 3 times, most recently from 90594b5 to d3f1cce Compare March 24, 2026 16:19
@mrkkrp-work
Copy link
Copy Markdown

I believe the only remaining failures are:

  • Min Rust Version on :ubuntu: Ubuntu 22.04 LTS error: the crate requires edition 2024, but the latest edition supported by this Rust version is 2021
  • Min Rust Version With Aspects on :ubuntu: Ubuntu 22.04 LTS error: the crate requires edition 2024, but the latest edition supported by this Rust version is 2021

What can be done about these?

@UebelAndre
Copy link
Copy Markdown
Collaborator

I believe the only remaining failures are:

* Min Rust Version on :ubuntu: Ubuntu 22.04 LTS `error: the crate requires edition 2024, but the latest edition supported by this Rust version is 2021`

* Min Rust Version With Aspects on :ubuntu: Ubuntu 22.04 LTS `error: the crate requires edition 2024, but the latest edition supported by this Rust version is 2021`

What can be done about these?

How did you update the dependencies? Do the current updates require bumps to transitive deps? If so what version was 2024 introduced?

@mrkkrp-work
Copy link
Copy Markdown

How did you update the dependencies?

I updated cargo_toml first and then attempted bazel run //crate_universe/3rdparty:crates_vendor but that wouldn't work, complaining that --locked is passed to the cargo invocation. I then resorted to Claude and told it everything I know about the problem and that bazel run //crate_universe/3rdparty:crates_vendor is supposed to work but it doesn't. 10 minutes and some exchanges later it reported that bazel run //crate_universe/3rdparty:crates_vendor now succeeds and the Cargo.lock is updated.

Do the current updates require bumps to transitive deps?

toml had to be updated to 0.9, see the PR description.

@UebelAndre
Copy link
Copy Markdown
Collaborator

I updated cargo_toml first and then attempted bazel run //crate_universe/3rdparty:crates_vendor but that wouldn't work, complaining that --locked is passed to the cargo invocation. I then resorted to Claude and told it everything I know about the problem and that bazel run //crate_universe/3rdparty:crates_vendor is supposed to work but it doesn't. 10 minutes and some exchanges later it reported that bazel run //crate_universe/3rdparty:crates_vendor now succeeds and the Cargo.lock is updated.

Can you show the error you saw?

toml had to be updated to 0.9, see the PR description.

That's fine but the failure is building getrandom-0.4.2 which might be an unnecessary bump depending on how you updated dependencies. If it's required then we'd need to discuss bumping the min Rust version but if not then we should figure out how to only bump the necessary dependencies.

@mrkkrp
Copy link
Copy Markdown
Contributor Author

mrkkrp commented Mar 24, 2026

Here is the complete output:

ubuntu@2c73efc816fa:/workspaces/rules_rust$ bazel run //crate_universe/3rdparty:crates_vendor
Extracting Bazel installation...
Starting local Bazel server (8.4.2) and connecting to it...
WARNING: For repository 'rules_cc', the root module requires module version rules_cc@0.2.4, but got rules_cc@0.2.8 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
    Updating crates.io index
error: cannot update the lock file /workspaces/rules_rust/crate_universe/Cargo.lock because --locked was passed to prevent this
help: to generate the lock file without accessing the network, remove the --locked flag and use --offline instead.
INFO: Repository +cu_nr+cargo_bazel_bootstrap instantiated at:
  <builtin>: in <toplevel>
Repository rule cargo_bootstrap_repository defined at:
  /workspaces/rules_rust/cargo/private/cargo_bootstrap.bzl:240:45: in <toplevel>
ERROR: /workspaces/rules_rust/cargo/private/cargo_bootstrap.bzl:93:13: An error occurred during the fetch of repository '+cu_nr+cargo_bazel_bootstrap':
   Traceback (most recent call last):
        File "/workspaces/rules_rust/cargo/private/cargo_bootstrap.bzl", line 220, column 35, in _cargo_bootstrap_repository_impl
                built_binary = cargo_bootstrap(
        File "/workspaces/rules_rust/cargo/private/cargo_bootstrap.bzl", line 93, column 13, in cargo_bootstrap
                fail(_FAIL_MESSAGE.format(
Error in fail: Process exited with code '101'
# ARGV ########################################################################
["/home/ubuntu/.cache/bazel/_bazel_ubuntu/10c94d3773e09de9e6b358fd1352489e/external/+rust_host_tools+rust_host_tools/bin/cargo", "build", "--bin", "cargo-bazel", "--locked", "--target-dir", "/home/ubuntu/.cache/bazel/_bazel_ubuntu/10c94d3773e09de9e6b358fd1352489e/external/+cu_nr+cargo_bazel_bootstrap", "--manifest-path", "/workspaces/rules_rust/crate_universe/Cargo.toml", "--release"]

# STDOUT ######################################################################


# STDERR ######################################################################
    Updating crates.io index
error: cannot update the lock file /workspaces/rules_rust/crate_universe/Cargo.lock because --locked was passed to prevent this
help: to generate the lock file without accessing the network, remove the --locked flag and use --offline instead.

ERROR: no such package '@@+cu_nr+cargo_bazel_bootstrap//': Process exited with code '101'
# ARGV ########################################################################
["/home/ubuntu/.cache/bazel/_bazel_ubuntu/10c94d3773e09de9e6b358fd1352489e/external/+rust_host_tools+rust_host_tools/bin/cargo", "build", "--bin", "cargo-bazel", "--locked", "--target-dir", "/home/ubuntu/.cache/bazel/_bazel_ubuntu/10c94d3773e09de9e6b358fd1352489e/external/+cu_nr+cargo_bazel_bootstrap", "--manifest-path", "/workspaces/rules_rust/crate_universe/Cargo.toml", "--release"]

# STDOUT ######################################################################


# STDERR ######################################################################
    Updating crates.io index
error: cannot update the lock file /workspaces/rules_rust/crate_universe/Cargo.lock because --locked was passed to prevent this
help: to generate the lock file without accessing the network, remove the --locked flag and use --offline instead.

ERROR: /workspaces/rules_rust/crate_universe/3rdparty/BUILD.bazel:10:14: //crate_universe/3rdparty:crates_vendor depends on @@+cu_nr+cargo_bazel_bootstrap//:binary in repository @@+cu_nr+cargo_bazel_bootstrap which failed to fetch. no such package '@@+cu_nr+cargo_bazel_bootstrap//': Process exited with code '101'
# ARGV ########################################################################
["/home/ubuntu/.cache/bazel/_bazel_ubuntu/10c94d3773e09de9e6b358fd1352489e/external/+rust_host_tools+rust_host_tools/bin/cargo", "build", "--bin", "cargo-bazel", "--locked", "--target-dir", "/home/ubuntu/.cache/bazel/_bazel_ubuntu/10c94d3773e09de9e6b358fd1352489e/external/+cu_nr+cargo_bazel_bootstrap", "--manifest-path", "/workspaces/rules_rust/crate_universe/Cargo.toml", "--release"]

# STDOUT ######################################################################


# STDERR ######################################################################
    Updating crates.io index
error: cannot update the lock file /workspaces/rules_rust/crate_universe/Cargo.lock because --locked was passed to prevent this
help: to generate the lock file without accessing the network, remove the --locked flag and use --offline instead.

ERROR: Analysis of target '//crate_universe/3rdparty:crates_vendor' failed; build aborted: Analysis failed
INFO: Elapsed time: 89.901s, Critical Path: 0.06s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully
ERROR: Build failed. Not running target

@UebelAndre
Copy link
Copy Markdown
Collaborator

Here is the complete output:

Can you try

bazel run //crate_universe/3rdparty:crates_vendor -- --repin

?

@mrkkrp
Copy link
Copy Markdown
Contributor Author

mrkkrp commented Mar 24, 2026

Yes, this was the first thing I tried before invoking Claude. Here's how that goes:

ubuntu@2c73efc816fa:/workspaces/rules_rust$ bazel run //crate_universe/3rdparty:crates_vendor -- --repin
    Updating crates.io index
error: cannot update the lock file /workspaces/rules_rust/crate_universe/Cargo.lock because --locked was passed to prevent this
help: to generate the lock file without accessing the network, remove the --locked flag and use --offline instead.
INFO: Repository +cu_nr+cargo_bazel_bootstrap instantiated at:
  <builtin>: in <toplevel>
Repository rule cargo_bootstrap_repository defined at:
  /workspaces/rules_rust/cargo/private/cargo_bootstrap.bzl:240:45: in <toplevel>
ERROR: /workspaces/rules_rust/cargo/private/cargo_bootstrap.bzl:93:13: An error occurred during the fetch of repository '+cu_nr+cargo_bazel_bootstrap':
   Traceback (most recent call last):
        File "/workspaces/rules_rust/cargo/private/cargo_bootstrap.bzl", line 220, column 35, in _cargo_bootstrap_repository_impl
                built_binary = cargo_bootstrap(
        File "/workspaces/rules_rust/cargo/private/cargo_bootstrap.bzl", line 93, column 13, in cargo_bootstrap
                fail(_FAIL_MESSAGE.format(
Error in fail: Process exited with code '101'
# ARGV ########################################################################
["/home/ubuntu/.cache/bazel/_bazel_ubuntu/10c94d3773e09de9e6b358fd1352489e/external/+rust_host_tools+rust_host_tools/bin/cargo", "build", "--bin", "cargo-bazel", "--locked", "--target-dir", "/home/ubuntu/.cache/bazel/_bazel_ubuntu/10c94d3773e09de9e6b358fd1352489e/external/+cu_nr+cargo_bazel_bootstrap", "--manifest-path", "/workspaces/rules_rust/crate_universe/Cargo.toml", "--release"]

# STDOUT ######################################################################


# STDERR ######################################################################
    Updating crates.io index
error: cannot update the lock file /workspaces/rules_rust/crate_universe/Cargo.lock because --locked was passed to prevent this
help: to generate the lock file without accessing the network, remove the --locked flag and use --offline instead.

ERROR: no such package '@@+cu_nr+cargo_bazel_bootstrap//': Process exited with code '101'
# ARGV ########################################################################
["/home/ubuntu/.cache/bazel/_bazel_ubuntu/10c94d3773e09de9e6b358fd1352489e/external/+rust_host_tools+rust_host_tools/bin/cargo", "build", "--bin", "cargo-bazel", "--locked", "--target-dir", "/home/ubuntu/.cache/bazel/_bazel_ubuntu/10c94d3773e09de9e6b358fd1352489e/external/+cu_nr+cargo_bazel_bootstrap", "--manifest-path", "/workspaces/rules_rust/crate_universe/Cargo.toml", "--release"]

# STDOUT ######################################################################


# STDERR ######################################################################
    Updating crates.io index
error: cannot update the lock file /workspaces/rules_rust/crate_universe/Cargo.lock because --locked was passed to prevent this
help: to generate the lock file without accessing the network, remove the --locked flag and use --offline instead.

ERROR: /workspaces/rules_rust/crate_universe/3rdparty/BUILD.bazel:10:14: //crate_universe/3rdparty:crates_vendor depends on @@+cu_nr+cargo_bazel_bootstrap//:binary in repository @@+cu_nr+cargo_bazel_bootstrap which failed to fetch. no such package '@@+cu_nr+cargo_bazel_bootstrap//': Process exited with code '101'
# ARGV ########################################################################
["/home/ubuntu/.cache/bazel/_bazel_ubuntu/10c94d3773e09de9e6b358fd1352489e/external/+rust_host_tools+rust_host_tools/bin/cargo", "build", "--bin", "cargo-bazel", "--locked", "--target-dir", "/home/ubuntu/.cache/bazel/_bazel_ubuntu/10c94d3773e09de9e6b358fd1352489e/external/+cu_nr+cargo_bazel_bootstrap", "--manifest-path", "/workspaces/rules_rust/crate_universe/Cargo.toml", "--release"]

# STDOUT ######################################################################


# STDERR ######################################################################
    Updating crates.io index
error: cannot update the lock file /workspaces/rules_rust/crate_universe/Cargo.lock because --locked was passed to prevent this
help: to generate the lock file without accessing the network, remove the --locked flag and use --offline instead.

ERROR: Analysis of target '//crate_universe/3rdparty:crates_vendor' failed; build aborted: Analysis failed
INFO: Elapsed time: 2.613s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully
ERROR: Build failed. Not running target

@UebelAndre
Copy link
Copy Markdown
Collaborator

Aaaaah, I just can't read

ERROR: /workspaces/rules_rust/cargo/private/cargo_bootstrap.bzl:93:13: An error occurred during the fetch of repository '+cu_nr+cargo_bazel_bootstrap':

This is caused by the bootstrap repository. What you can do is run cargo update --workspace in the crate_universe directory.

The code in `src/splicing.rs` uses `toml::Value` types that were
incompatible—the workspace used `toml` 0.8.x but cargo_toml 0.22.3 depends
on `toml` 0.9.x, creating a type mismatch. Therefore, `Cargo.toml` was
updated to use to use `toml = "0.9"` instead of `"0.8.21"`.
@mrkkrp mrkkrp force-pushed the mrkkrp/update-cargo-toml-origin-main branch from d3f1cce to b5e5f65 Compare March 25, 2026 14:56
@UebelAndre UebelAndre enabled auto-merge March 25, 2026 14:58
auto-merge was automatically disabled March 25, 2026 15:29

Head branch was pushed to by a user without write access

@UebelAndre UebelAndre enabled auto-merge March 25, 2026 15:29
auto-merge was automatically disabled March 25, 2026 15:36

Head branch was pushed to by a user without write access

@mrkkrp mrkkrp force-pushed the mrkkrp/update-cargo-toml-origin-main branch from 121f055 to d83571d Compare March 25, 2026 15:36
@mrkkrp-work
Copy link
Copy Markdown

@UebelAndre I've redone the update following your suggestions, there are still failures, seemingly the same?

@UebelAndre
Copy link
Copy Markdown
Collaborator

@UebelAndre I've redone the update following your suggestions, there are still failures, seemingly the same?

Yeah, but this dependency makes more sense, toml_writer is a direct dependency of toml. Do you know when edition 2024 was released? And @illicitonion do you have any objections to raising the MSRV?

@mrkkrp-work
Copy link
Copy Markdown

Do you know when edition 2024 was released?

The Rust 2024 edition was officially released on February 20, 2025, alongside Rust 1.85.0.

Please let me know if I can do anything to help this PR advance.

@UebelAndre
Copy link
Copy Markdown
Collaborator

I filed #3936

@UebelAndre UebelAndre enabled auto-merge March 29, 2026 17:55
@UebelAndre UebelAndre added this pull request to the merge queue Mar 29, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 29, 2026
@UebelAndre UebelAndre added this pull request to the merge queue Mar 29, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 29, 2026
@UebelAndre UebelAndre added this pull request to the merge queue Mar 29, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 29, 2026
@UebelAndre UebelAndre added this pull request to the merge queue Mar 29, 2026
Merged via the queue into bazelbuild:main with commit 71aae07 Mar 29, 2026
3 checks passed
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.

Support for Cargo.toml v3 in extract_cargo_lints

3 participants