Commit graph

132 commits

Author SHA1 Message Date
Esteban Küber
88bafd161e Change tests to support changes to suggestion
`rustc` will start marking the suggestions for prefacing unused bindings
with underscores as "maybe incorrect", which makes them no longer auto
applicable by `rustfix`.

Change done at https://github.com/rust-lang/rust/pull/120470.
2024-02-01 03:47:27 +00:00
Eric Huss
e7eaa51909 cargo fix: Call rustc fewer times.
This changes `cargo fix` so that it keeps track of the output so that it
doesn't need to run the final "show the output" step.
2024-01-02 15:03:06 -08:00
Eric Huss
8ffd9cd86f Add tests validating the sequence for cargo fix.
This adds a set of tests which validates various edge cases around how
`cargo fix` works in terms of calling `rustc` multiple times. This uses
a replacement of `rustc` so it doesn't depend on the behavior of rustc
itself which is not always stable.
2024-01-02 14:54:41 -08:00
Eric Huss
1ef1b7e313 Fix fix::fix_in_dependency to not rely on rustc 2023-12-29 12:56:23 -08:00
Adrian
b7b5a093a1
Fix cargo errors counter 2023-11-29 18:47:14 +02:00
belovdv
6b86f93713 remove jobserver in shim for tests in testsuite/fix 2023-11-29 15:30:58 +03:00
Eric Huss
2eac6f5c0c Fix clippy-wrapper test race condition. 2023-11-18 17:23:29 -08:00
hi-rustin
08169fd015 Add rustc_shim_for_cargo_fix and wrapped_clippy_driver to reuse code
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-04-14 11:23:41 +08:00
hi-rustin
47f6e2ddc9 Add broken_clippy_fixes_backed_out
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-04-14 10:46:53 +08:00
Adrián Ortiz
db457d950f Fixing issue https://github.com/rust-lang/cargo/issues/10834:
- Adding display of which target failed to compile
- Consistent messages for warnings/errors.
- Fixing assertions on related tests.
2023-03-07 06:45:26 +01:00
Scott Schafer
9c14193764 chore: update fix tests to use check 2023-02-20 12:21:15 -06:00
hi-rustin
21b2fe98a4 Fix fix_in_existing_repo_weird_ignore broken test
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-11-26 20:15:36 +08:00
hi-rustin
3189dc3b06 Include untracked files
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-11-26 20:15:36 +08:00
hi-rustin
25f7d4b09a Remove new_repo_without_add_and_commit
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-11-26 20:15:36 +08:00
hi-rustin
89b8a8bb10 Suppress error with --allow-dirty and add a test
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-11-26 20:15:36 +08:00
Eric Huss
1c3640e05c Add requirements to cargo_test. 2022-07-30 19:36:58 -07:00
Scott Schafer
c239e407e7 add a reason to masquerade_as_nightly_cargo so it is searchable 2022-07-15 21:32:23 -05:00
Scott Schafer
4bc8fe85bd remove unneeded nightly flags from various tests 2022-07-14 19:55:44 -05:00
Weihang Lo
d813739c76
test: make tests compatible when force using argfile 2022-04-10 22:23:20 +08:00
Eric Huss
88117505b8 Bump to 0.59.0 2021-10-22 07:53:17 -07:00
Weihang Lo
0565dafd87
Skip all cargo fix that tends to write to registry cache. 2021-09-23 23:31:10 +08:00
Eric Huss
7a6377092c Make --force-warn support auto-detect. 2021-08-31 22:24:02 -07:00
Eric Huss
46450d6e3a Change cargo fix --edition to only fix edition lints. 2021-08-27 11:28:03 -07:00
Eric Huss
e0bd1877d0 Fix test not to rely on cargo in PATH. 2021-08-26 14:06:32 -07:00
bors
3f68ff4fe3 Auto merge of #9818 - hi-rustin:rustin-patch-fix, r=alexcrichton
unset the FIX_ENV when executing the real rustc

close https://github.com/rust-lang/cargo/issues/9706
2021-08-23 17:03:28 +00:00
bors
8b5771f05e Auto merge of #9792 - weihanglo:issue-9782, r=ehuss
Emit warning for migrating to unstable edition in stable channel

Resolves #9782

Also alter the original error message slightly.
2021-08-23 16:07:05 +00:00
hi-rustin
4c11002b9d Better fmt for file body
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-08-21 23:54:59 +08:00
hi-rustin
4225c46297 unset the FIX_ENV when executing the real rustc
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-08-21 23:48:49 +08:00
bors
259ea8c055 Auto merge of #9803 - ehuss:fix-edition-resolve-differences-dev-deps, r=alexcrichton
Show feature resolver differences for dev-dependencies.

During the crater run for 2021, there was a package that failed to update in a confusing way. The issue is that a feature was removed in the new resolver, but only for a dev-dependency. The report displayed with `cargo fix --edition` did not say anything about that, so it took me a bit to figure it out.  This changes it so that the report also includes changes to features of dev-dependencies.  I honestly don't remember my thought process behind the original code.

For example, the offending package now says:

```
When building the following dependencies, the given features will no longer be used:

  log v0.4.8 removed features: std
  syn v0.15.44 (as host dependency) removed features: extra-traits, visit

The following differences only apply when building with dev-dependencies:

  phf_shared v0.7.24 (as host dependency) removed features: unicase
```

And the error that happens after updating to 2021 is:

```
error[E0277]: the trait bound `UniCase<&str>: phf_shared::PhfHash` is not satisfied
  --> /Users/eric/.cargo/registry/src/github.com-1ecc6299db9ec823/mime_guess-1.8.7/build.rs:37:21
   |
37 |         forward_map.entry(UniCase(key), &format!("{:?}", val));
   |                     ^^^^^ the trait `phf_shared::PhfHash` is not implemented for `UniCase<&str>`
```

Hopefully developers will be able to see the note about the feature `unicase` being removed from `phf_shared`, and the error message about `UniCase` not implementing `PhfHash`, and connect the two together.  Previously, the upgrade report didn't mention anything about `phf_shared`, and thus no clues on what went wrong.
2021-08-18 14:09:06 +00:00
Eric Huss
5939e212e0 Show feature resolver differences for dev-dependencies. 2021-08-17 16:41:53 -07:00
Eric Huss
5f274b018f Show information about abnormal fix errors. 2021-08-17 08:49:47 -07:00
Weihang Lo
e5d6586cf8
Test for warning of migrating to unstable edition 2021-08-15 17:16:39 +08:00
Eric Huss
be0cbb57c7 cargo fix --edition: extend warning when on latest edition 2021-07-15 07:26:26 -07:00
bors
f2496ee6ee Auto merge of #9677 - ehuss:serialize-fix, r=alexcrichton
Serialize `cargo fix`

This changes `cargo fix` so that it only fixes one crate at a time. Previously, it would allow concurrent fixing across packages. This caused a problem if a workspace uses things like `#[path]` or `include!()` of a shared file between packages. A real-world example of this is serde, which has [this](9c39115f82/serde_derive_internals/lib.rs (L43-L45)) which reuses the some source files between the `serde` and `serde_derive` packages. Modifying those files concurrently causes corruption and the fix will fail.

Closes #6528
2021-07-12 16:16:36 +00:00
bors
a51667c60d Auto merge of #9662 - ehuss:unignore-fix_edition_2021, r=alexcrichton
Unignore fix_edition_2021.

The issue has been fixed by https://github.com/rust-lang/rust/pull/86572.
2021-07-12 13:39:49 +00:00
Eric Huss
c8e4f8e483 Serialize cargo fix 2021-07-10 18:47:52 -07:00
Eric Huss
93658ee1be Unignore fix_edition_2021. 2021-07-06 19:28:13 -07:00
Joshua Nelson
9c7cc545d7 Combine rustc and cargo's diagnostic summaries
This works by introspecting rustc's error output, using the JSON format
to determine whether it's a warning or error, then skipping it
altogether if it's a summary of the diagnostics printed.

Before:

```
src/main.rs:1:10: warning: trait objects without an explicit `dyn` are deprecated
src/main.rs:1:1: error[E0601]: `main` function not found in crate `wrong`
src/main.rs:1:9: error[E0038]: the trait `Clone` cannot be made into an object
error: aborting due to 2 previous errors; 1 warning emitted
error: could not compile `wrong`

```

After:

```
$ cargo check --message-format short
src/main.rs:1:10: warning: trait objects without an explicit `dyn` are deprecated
src/main.rs:1:1: error[E0601]: `main` function not found in crate `wrong`
src/main.rs:1:9: error[E0038]: the trait `Clone` cannot be made into an object
error: could not compile `wrong` due to 2 previous errors; 1 warning emitted
```
2021-07-06 19:46:27 -04:00
Eric Huss
5559e028a8 Adjust the edition2021 resolver diff report. 2021-07-02 13:01:58 -07:00
Eric Huss
aab51362d7 Temporarily ignore 2021 edition fix. 2021-06-30 09:36:22 -07:00
Eric Huss
5825206acf Enable support for fix --edition for 2021. 2021-06-15 13:13:35 -07:00
Sunjay Varma
f68cdb9947 Change how the fix_deny_warnings_but_not_others test works to avoid breakage from new compiler suggestions 2021-06-10 16:49:29 -07:00
bors
40b674cd11 Auto merge of #9566 - ehuss:relative-rustc-path, r=alexcrichton
Fix rustc/rustdoc config values to be config-relative.

The `rustc`, `rustdoc`, `rustc_wrapper`, and `rustc_workspace_wrapper` config values (in the `[build]` table) were being interpreted literally. This caused a problem if you used a relative path like `foo/rustc`.  This would be interpreted as a relative path from whatever cwd cargo launches rustc from, which changes for different scenarios, making it essentially unusuable (since crates.io dependencies wouldn't be buildable).

Additionally, due to https://github.com/rust-lang/rust/issues/37868, it is a bad idea to use relative paths.

This changes it so that those paths are config-relative.  Bare names (like "my-rustc-program") still use PATH as before.

This also includes a commit to centralize the rustc-wrapper program used by several tests so that it isn't built multiple times (and to allow several tests to work on windows).

Fixes #8202
2021-06-10 14:15:18 +00:00
Eric Huss
9362fe5ff3 Update rustfix. 2021-06-09 18:13:56 -07:00
Eric Huss
7b229bbe39 Move the rustc-echo-wrapper to be shared across tests.
This helps avoid rebuilding the same project several times.
2021-06-09 17:13:33 -07:00
Yuki Okushi
e5ab39145f Only deny the unused_mut lint 2021-04-28 17:59:57 +09:00
Eric Huss
501499c5f9 Add report if cargo fix --edition changes features. 2021-03-16 11:39:21 -07:00
Eric Huss
c303213748 cargo fix: Remove --prepare-for option.
This was deprecated, never officially part of the stable release.
2021-02-19 14:29:45 -08:00
Eric Huss
aa61976c5f Make edition transitions easier.
This attempts to centralize all the edition stuff in one place (the
`Edition` enum) so that adding a new edition or stabilizing one should
be relatively little work (and more importantly, we don't miss things).

Importantly, this changes `cargo new` to default to the latest stable.
It also changes the `cargo fix --edition-idiom` behavior to only apply
idioms for the *current* edition.
2021-02-19 14:29:44 -08:00
Eric Huss
28850225a1 Updates to cargo fix --edition.
* `--edition` always means "next" edition.
* `--edition` when on the most recent edition is not an error, just a warning.
* Support fix to 2021 edition.
2021-02-17 22:12:46 -08:00