-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Iteratively apply suggestions from the compiler
This commit updates the `cargo fix` implementation to iteratively apply fixes from the compiler instead of only once. Currently the compiler can sometimes emit overlapping suggestions, such as in the case of transitioning ::foo::<::Bar>(); to ... crate::foo::<crate::Bar>(); and `rustfix` rightfully can't handle overlapping suggestions as there's no clear way of how to disambiguate the fixes. To fix this problem Cargo will now run `rustc` and `rustfix` multiple times, attempting to reach a steady state where no fixes failed to apply. Naturally this is a pretty tricky thing to do and we want to be sure that Cargo doesn't loop forever, for example. A number of safeguards are in place to prevent Cargo from going off into the weeds when fixing files, notably avoiding to reattempt fixes if no successful fixes ended up being applied. Closes #5813 Closes rust-lang/rust#52754
- Loading branch information
1 parent
9bbab73
commit 876a503
Showing
4 changed files
with
173 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters