Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate rustfix to the cargo repo #13005

Merged
merged 396 commits into from
Nov 21, 2023
Merged

Migrate rustfix to the cargo repo #13005

merged 396 commits into from
Nov 21, 2023

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Nov 19, 2023

This migrates the rustfix crate from https://github.com/rust-lang/rustfix/ to the cargo repo. The cargo team has been responsible for the client-side of cargo fix, and it can make it easier to maintain with all our tooling and tracking here. This crate is used by some external parties (like the compiler), so it will need to be maintained like an "ecosystem" package, but hopefully there shouldn't be any outside requirements (I haven't seen any in several years).

After merging, I'll follow up with some things to address in the future, such as:

  • Migrating issues from the other repo.
  • Opening new issues for some cleanup tasks, such as adding documentation, fixing the #[ignore] annotations, fixing testing on windows, maybe migrating the test code to use different dependencies, various code cleanup.
  • Archiving the repo.

killercup and others added 30 commits May 3, 2018 14:41
- rustfix stays as the library crate
- cargo-fix becomes the new binary crate
This commit starts rewritign the `cargo fix` command in line with the recent
discussions around the edition. The main changes here are:

* The interactivity of `cargo fix` is removed
* Executing `cargo fix` is now a thin veneer over `cargo check`
* Fixes are automatically applied when it looks very likely to succeed if we
  apply them.
* Fixes are only applied to the local workspace rather than upstream crates as
  well.

There's still a number of missing features to fill out marked with a few TODO
here and there but the test suite is already looking relatively solid. I think
we've got a long way to go here but this is hopefully a good start in the
direction of where we want to go.
Use a more clever way to replace parts of a file
Make sure that we always run the version that we're compiling locally
Fix tests if `cargo fix` is already installed
Don't use a compilation error to test rustfix but instead use a lint.
This commit causes rustfix to bail out of attempting to fix a crate if it
encounters already broken code. We wouldn't want to make the situation worse by
accidentally introducing more breakage!
While this shouldn't show up it's best if we don't break users' code. Back out
all file changes if this happens and make sure that we never break code with the
fixes that we applied.
Override any `deny(warnings)` settings to try to fix as many issues as possible.
This way we can fix fixable warnings with `#[deny(warnings)]` but any unfixed
warnings still get printed later as warnings.
Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

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

Not blockers just call them out.

crates/rustfix/Readme.md Outdated Show resolved Hide resolved
@weihanglo
Copy link
Member

weihanglo commented Nov 20, 2023

This command is failing cargo bump-check CI job:

cargo semver-checks -p rustfix --baseline-rev 1d8b05cdd1287c64467306cf3ca2c8ac60c11eb0

Seems like there is already a report in cargo-semver-checks: obi1kenobi/cargo-semver-checks#481

The scenario is a newly added package missing in the baseline version.

@weihanglo
Copy link
Member

weihanglo commented Nov 20, 2023

We might want to exclude rustfix from baseline check for now. Once rustfix-in-cargo hit stable (or beta if we want robustness), we can add it back.

diff --git a/crates/xtask-bump-check/src/xtask.rs b/crates/xtask-bump-check/src/xtask.rs
index cba420f051b..932d3ad1946 100644
--- a/crates/xtask-bump-check/src/xtask.rs
+++ b/crates/xtask-bump-check/src/xtask.rs
@@ -166,6 +166,7 @@ fn bump_check(args: &clap::ArgMatches, config: &cargo::util::Config) -> CargoRes
         let mut cmd = ProcessBuilder::new("cargo");
         cmd.arg("semver-checks")
             .arg("--workspace")
+            .args(&["--exclude", "rustfix"])
             .arg("--baseline-rev")
             .arg(referenced_commit.id().to_string());
         config.shell().status("Running", &cmd)?;

@rustbot rustbot added the A-documenting-cargo-itself Area: Cargo's documentation label Nov 21, 2023
@ehuss
Copy link
Contributor Author

ehuss commented Nov 21, 2023

Thanks for catching all the things I missed!

Do we want a A-rustfix label or just accommendate them in Command-fix?

I think for now I would prefer to just keep one label (Command-fix). I think in practice it is unlikely we will want to try to distinguish between the two, and it would make it a little more awkward to find issues because you would need to include both in your query.

We would like to update [autolabel] in triagebot.toml as well.

Added.

Update places mentioning rusfix in Cargo Contributor Guide

Updated.

We might want to exclude rustfix from baseline check for now. Once rustfix-in-cargo hit stable (or beta if we want robustness), we can add it back.

I have applied your patch.

@weihanglo
Copy link
Member

Thank you ehuss for the migration!

@bors r+

@bors
Copy link
Contributor

bors commented Nov 21, 2023

📌 Commit 47c7ff0 has been approved by weihanglo

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 21, 2023
@bors
Copy link
Contributor

bors commented Nov 21, 2023

⌛ Testing commit 47c7ff0 with merge eed300d...

@bors
Copy link
Contributor

bors commented Nov 21, 2023

☀️ Test successful - checks-actions
Approved by: weihanglo
Pushing eed300d to master...

@bors bors merged commit eed300d into rust-lang:master Nov 21, 2023
22 checks passed
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 25, 2023
Update cargo

7 commits in 71cd3a926f0cf41eeaf9f2a7f2194b2aff85b0f6..9b13310ca596020a737aaa47daa4ed9ff8898a2f
2023-11-20 15:30:57 +0000 to 2023-11-24 16:20:51 +0000
- feat: Add `CARGO_RUSTC_CURRENT_DIR` (unstable) (rust-lang/cargo#12996)
- Exited with hard error when custom build file no existence or not in package (rust-lang/cargo#12995)
- try running on windows (rust-lang/cargo#13042)
- refactor(toml): Better abstract inheritance details (rust-lang/cargo#13021)
- cargo-test-support: Add features to the default Cargo.toml file (rust-lang/cargo#12997)
- Migrate rustfix to the cargo repo (rust-lang/cargo#13005)
- typo: rusc -> rustc (rust-lang/cargo#13019)

---

This also removes the check to ensure that `rustfix` between

* src/tools/cargo
* src/tools/compiletest

has the same version,
since `rust-lang/rustfix` has migrated to under `rust-lang/cargo`.

r? ghost
@rustbot rustbot added this to the 1.76.0 milestone Nov 25, 2023
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Nov 27, 2023
Update cargo

7 commits in 71cd3a926f0cf41eeaf9f2a7f2194b2aff85b0f6..9b13310ca596020a737aaa47daa4ed9ff8898a2f
2023-11-20 15:30:57 +0000 to 2023-11-24 16:20:51 +0000
- feat: Add `CARGO_RUSTC_CURRENT_DIR` (unstable) (rust-lang/cargo#12996)
- Exited with hard error when custom build file no existence or not in package (rust-lang/cargo#12995)
- try running on windows (rust-lang/cargo#13042)
- refactor(toml): Better abstract inheritance details (rust-lang/cargo#13021)
- cargo-test-support: Add features to the default Cargo.toml file (rust-lang/cargo#12997)
- Migrate rustfix to the cargo repo (rust-lang/cargo#13005)
- typo: rusc -> rustc (rust-lang/cargo#13019)

---

This also removes the check to ensure that `rustfix` between

* src/tools/cargo
* src/tools/compiletest

has the same version,
since `rust-lang/rustfix` has migrated to under `rust-lang/cargo`.

r? ghost
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 8, 2023
docs: publish nightly doc for `rustfix`

`rustfix `has migrated into rust-lang/cargo in <rust-lang/cargo#13005>. We now can publish nightly doc for it.
bors added a commit to rust-lang/miri that referenced this pull request Dec 10, 2023
docs: publish nightly doc for `rustfix`

`rustfix `has migrated into rust-lang/cargo in <rust-lang/cargo#13005>. We now can publish nightly doc for it.
lnicola pushed a commit to lnicola/rust-analyzer that referenced this pull request Apr 7, 2024
docs: publish nightly doc for `rustfix`

`rustfix `has migrated into rust-lang/cargo in <rust-lang/cargo#13005>. We now can publish nightly doc for it.
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this pull request Apr 27, 2024
docs: publish nightly doc for `rustfix`

`rustfix `has migrated into rust-lang/cargo in <rust-lang/cargo#13005>. We now can publish nightly doc for it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-documenting-cargo-itself Area: Cargo's documentation A-infrastructure Area: infrastructure around the cargo repo, ci, releases, etc. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.