Skip to content

Conversation

@IceSentry
Copy link
Contributor

@IceSentry IceSentry commented Dec 5, 2025

Objective

  • When bisecting a bug we end up using older versions of bevy that don't always compile with the most recent compiler
  • We use cutting edge features and not everyone has the latest compiler version installed and they end up seeing errors that might not be easy to understand

Solution

  • Add a rust-toolchain file to document which compiler version is used for the current state of the repo
  • This way when using git bisect we don't have to guess at which compiler version we should be using
  • This means we will have to make a new PR to update the file every time there's a new rust version or at least every time we use a feature from a newer rust version
  • Unfortunately, this caused a few issues with CI so I had to add rustup override steps to a few of the CI actions that were expecting a specific rust version or component. This way CI essentially doesn't have to care about the toolchain file.

Testing

  • I tested a local build and it used the expected compiler version

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

You added a new example but didn't add metadata for it. Please update the root Cargo.toml file.

@james7132 james7132 requested a review from mockersf December 7, 2025 23:18
@mockersf
Copy link
Member

mockersf commented Dec 7, 2025

@IceSentry IceSentry added A-Build-System Related to build systems or continuous integration C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Dec 9, 2025
@IceSentry
Copy link
Contributor Author

I added a daily dependabot job for the rust-toolchain. Not sure if that's the best schedule. I wouldn't be surprised if a human will always end up doing it first since a rust release is hard to miss for anyone that tracks them

@@ -0,0 +1,2 @@
[toolchain]
channel = "1.91.1"
Copy link
Member

Choose a reason for hiding this comment

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

I see the value in being exact, but before adding semi-redundant "things", can you verify that the minimum Rust version in Cargo.toml does not meet your needs?

[package]
rust-version = "1.88.0"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I didn't realize we even had a rust version specified.

Are you saying I should set the toolchain value to match that 1.88 or are you saying that the toolchain file is redundant?

Copy link
Member

Choose a reason for hiding this comment

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

I'm saying it is partially redundant. It is a piece of metadata that we already bump periodically, that is an attestation that Bevy requires features from that version.

The big tradeoff is that we aren't actually running our CI for that version (we use latest stable).

Copy link
Member

Choose a reason for hiding this comment

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

The question is ... is that enough of a solve for your usecase, given that the proposal adds more complexity to our process.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I admit that being aware of the rust version does change things a little bit, but in my case the reason I want it is for the ability to git bisect and having cargo automatically detect the toolchain it should be using makes it simpler. With that said, yeah, I guess the rust-version field solves the "guessing the compatible rust version" part. Either it didn't exist until recently or that field is essentially ignored by cargo though, because me and many people I've talked to on discord have had issues with invalid rust versions when running git bisect.

Copy link
Member

Choose a reason for hiding this comment

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

The big tradeoff is that we aren't actually running our CI for that version (we use latest stable).

We don't run all the CI on it, but Bevy is built in CI with the rust version from rust-version in this job: https://github.com/bevyengine/bevy/blob/main/.github/workflows/ci.yml#L456

it didn't exist until recently

It was (only) added 3 years ago

I think the issue is maybe with lints (builtin or clippy), with every rust version having new lints that Bevy fails. Or it did happen a few times that new versions of Rust don't compile Bevy, this is fixed usually well enough in advance by the Rust team with PR to Bevy, but if you go back in history with a modern version of rust it will fail to compile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Build-System Related to build systems or continuous integration C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants