Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ehuss
Copy link
Contributor

@ehuss ehuss commented May 24, 2025

This introduces a new "fix" mode to run cargo fix. This is primarily intended to support edition migration testing.

This includes two related changes:

  • Adds the ability to change the CapLints behavior because setting CapLints interferes with how cargo fix works.
  • Sets the mount mode of the source directory to read-write because cargo fix inherently needs to be able to write to the source directory.

It probably needs more work for general purpose cargo fix testing (non-edition) because otherwise it would need to rebuild the source directory between toolchains. I don't need that right now, so deferred that till later.

The edition testing is intended to work with cargo -Zfix-edition which performs the necessary actions to work in crater. More documentation (on the forge) will be coming once this is merged.

@ehuss ehuss marked this pull request as ready for review June 18, 2025 22:42
@ehuss
Copy link
Contributor Author

ehuss commented Jun 19, 2025

@Mark-Simulacrum I think this should be ready to merge. Let me know if you have any questions or need a walkthrough.

Copy link
Member

@Mark-Simulacrum Mark-Simulacrum left a comment

Choose a reason for hiding this comment

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

Can you say more about how the writable source will work in practice? Is it a requirement that before/after toolchains are executed on the same (mutated) directory? I think that's mostly the case today but long term I'd like to avoid it (for retrying builds etc).

@ehuss
Copy link
Contributor Author

ehuss commented Jun 28, 2025

Yea. It's actually a requirement that they don't share a mutated source directory. The intent for the edition testing is that the start toolchain will not apply any changes (it just runs cargo check since we'll be using the special -Zfix-edition flag). Only the end toolchain will be mutating the directory. My assumption is that start is always run before end. So in theory that should just work if I am understanding things correctly.

In the future if we want to extend this for more general-purpose cargo fix testing where we want to test cargo fix on both the start and end, then we'll need some more work to be done here. However, for my purposes, I don't need that right now.

I haven't really thought about how to make that safer. I don't recall if there is a way to do some kind of overlay fs mount that could just discard any modifications. Else I guess it will have to snapshot the source directory somehow? Or it could just delete and recreate it, but I worry about that being too expensive for git repos.

This introduces a new "fix" mode to run `cargo fix`. This is primarily
intended to support edition migration testing.

This includes two related changes:

- Adds the ability to change the CapLints behavior because setting
  CapLints interferes with how `cargo fix` works.
- Sets the mount mode of the source directory to read-write because
  `cargo fix` inherently needs to be able to write to the source
  directory.

It probably needs more work for general purpose `cargo fix` testing
(non-edition) because otherwise it would need to rebuild the source
directory between toolchains. I don't need that right now, so deferred
that till later.
@Mark-Simulacrum
Copy link
Member

My assumption is that start is always run before end

Yeah, the particular reason I was asking is that I'd like to decouple the start and end jobs more (so they're able to run on entirely different instances, etc.) so any dependency being added there is annoying. But this seems fine.

I think that assumption mostly holds today - I'm a little worried about our retry logic (that's internal to the workers themselves), but I think it should be OK. At minimum nothing here seems directly wrong.

Looks like lints are failing, ping me on Zulip once those are fixed and happy to queue it up for merging.

This was recently added to nightly.
@Mark-Simulacrum Mark-Simulacrum added this pull request to the merge queue Jun 28, 2025
Merged via the queue into rust-lang:master with commit a6b847b Jun 28, 2025
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.

2 participants