50 Commits

Author SHA1 Message Date
Scott Schafer
022dc5b381
chore: Address most typos 2025-09-02 18:15:50 -06:00
Eric Huss
1ce8023626 Rustfmt 2024 2025-07-05 19:50:36 -07:00
Ross Sullivan
92d9a94d02
chore: Migrated testsuite to testsuite::prelude 2025-06-25 22:37:24 +09:00
Eric Huss
0b2299e889 Remove an excess newline
The udpate_message already has a newline when it is there. When it is an
empty string, it ends up adding an unnecessary blank line.
2025-03-21 16:32:28 -07:00
Eric Huss
b17b9a4b90 Elaborate the full output when there are newer versions available
This output was never tested.
2025-03-21 16:32:28 -07:00
Eric Huss
4d961ed19c Don't show a suggestion to update dependencies
This removes the suggestion to update dependencies when the future
incompat error comes from the local crate. It doesn't make sense to
suggest that.
2025-03-21 16:32:28 -07:00
Eric Huss
497cfe5e48 Remove excess trailing space 2025-03-21 16:32:28 -07:00
Eric Huss
3fb97ecf28 Fix off-by-one error when future-incompat report is cached
This fixes a problem introduced by
https://github.com/rust-lang/cargo/pull/11648 where the future-incompat
report will tell you to run with an `--id` flag with the wrong value
if the report is already cached.

The solution is to add a method to determine which ID to use for the
suggestions *before* attempting to save the report.
2025-03-21 16:32:26 -07:00
Eric Huss
afdfd9263e Add some more explicit future-incompat tests
This updates some tests to include the full output for both a local
crate and a dependency.
2025-03-21 16:26:45 -07:00
Eric Huss
941c414a90 Add test for cached report id 2025-03-21 16:04:43 -07:00
Ed Page
55350fc670 test: Switch from 'exec_with_output' to 'run'
This is a follow up to #14846 which changed `run` to return the
`RawOutput`.

Reasons I didn't "update" some code to the new `run` return value
- We were actually using `ProcessBuilder::exec_with_output` and I didn't
  want to disentangle what it would take to switch to `Execs`
- We did processing on the `Result` and I didn't want to check how that
  could be updated
2024-11-21 13:48:27 -06:00
Ed Page
f80fc018a6 test: Ensure we don't rely on unit return values
This will allow changing `Execs::run` return type
2024-11-18 20:52:53 -06:00
Ed Page
af3cfd5abe fix(test): Un-deprecate contains assertions 2024-11-07 15:55:35 -06:00
Ed Page
a6cf1be655 test: Switch from allow to expect deprecated
This caught a couple of lingering items.
2024-09-23 20:44:06 -05:00
Ed Page
5b9799c6f4 refactor: Migrate from extern crate to test-support prelude
We now include the prelude in so many places, this simplifies how we can
present how `cargo-test-support` works.

Yes, this included some `use` clean ups but its already painful enough
walking through every test file, I didn't want to do it twice.
2024-07-12 15:57:00 -05:00
eth3lbert
ef27c273af
test: migrate future_incompat_report to snapbox 2024-07-02 08:42:34 +08:00
Ed Page
dc5ac62cab fix(test): Deprecate non-snapbox assertions
While this is noisy and hides other deprecations, I figured deprecations would
make it easier for people to discover what tasks remain and allow us to
divide and conquer this work rather than doing a heroic PR.
In theory, this will be short lived and we'll go back to seeing
deprecations in our tests.
2024-06-10 10:20:52 -05:00
Eric Huss
52d2303dd0 Update future-incompat output test for latest nightly. 2024-02-15 09:36:40 -08:00
Ed Page
4bf1af0cd0 fix(update): Make -p more convenient by being positional
Generally, cargo avoids positional arguments.  Mostly for the commands
that might forward arguments to another command, like `cargo test`.
It also allows some flexibility in turning flags into options.

For `cargo add` and `cargo remove`, we decided to accept positionals
because the motivations didn't seem to apply as much (similar to `cargo
install`).

This applies the pattern to `cargo update` as well which is in the same
category of commands as `cargo add` and `cargo remove`.

As for `--help` formatting, I'm mixed on whether `[SPEC]...` should be at the top like
other positionals or should be relegated to "Package selection".  I went
with the latter mostly to make it easier to visualize the less common
choice.

Switching to a positional for `cargo update` (while keeping `-p` for
backwards compatibility) was referenced in #12425.
2023-08-23 11:57:36 -05:00
Weihang Lo
b567a67d5c
test: bypass rustc --test impl details for -Zfuture-incompat-test
Switch to an empty `lib.rs` from `main.rs`.

See https://github.com/rust-lang/rust/issues/114804#issuecomment-1677233355
2023-08-14 13:40:47 +01:00
Scott Schafer
4934dffa5a chore: update future_incompat_report tests to use check 2023-02-20 12:21:27 -06: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
cuishuang
6f13c466d2 fix some typos
Signed-off-by: cuishuang <imcusg@gmail.com>
2022-05-08 01:07:28 +08:00
Ed Page
cdec3838a8 Extend pkgid syntax with @ support
In addition to `foo:1.2.3`, we now support `foo@1.2.3` for pkgids.  We
are also making it the default way of rendering pkgid's for the user.

With cargo-add in #10472, we've decided to only use `@` in it and to add
it as an alternative to `:` in the rest of cargo.  `cargo-add`
originally used `@`.  When preparing it for merge, I switched to `:` to
be consistent with pkgids. When discussing this, it was felt `@` has
precedence in too many tools to switch to `:` but that we should instead
switch pkgid's to use `@`, in a backwards compatible way.

See also https://internals.rust-lang.org/t/feedback-on-cargo-add-before-its-merged/16024/26?u=epage
2022-04-19 16:00:15 -05:00
Aaron Hill
997bf3fffc
Stabilize future-incompat-report
Depends on https://github.com/rust-lang/rust/pull/91535
2021-12-05 14:14:32 -05:00
Aaron Hill
5c3b38086f
Adjust comments 2021-10-18 12:06:23 -05:00
Aaron Hill
958f2fc962
Display more information in report 2021-10-18 12:01:07 -05:00
Aaron Hill
6f18507092
Display update message in report 2021-10-12 17:02:13 -05:00
Aaron Hill
49ae189b3b
Combined newer versions into single list 2021-10-12 16:35:01 -05:00
Aaron Hill
ce259228cd
Change package spec 2021-10-12 16:35:01 -05:00
Aaron Hill
20340e1e79
Rename arg and adjust tests 2021-10-12 16:35:01 -05:00
Aaron Hill
d5538c3869
Make future-incompat-report output more user-friendly
When the user enables `--future-incompat-report`, we now display
a high-level summary of the problem, as well as several suggestions
for fixing the affected crates.

The command `cargo report future-incompatibilities` now takes
a `--crate` option, which can be used to display a report
(including the actual lint messages) for a single crate.
When this option is not used, we display the report for all
crates.
2021-10-12 16:35:01 -05:00
Aaron Hill
88679e07f2
Implement [future-incompat-report] config section
Currently, I've just implemented the `always` and `never` frequencies
from the RFC, which don't require tracking any additional state.
2021-08-19 15:59:36 -05:00
Eric Huss
f00a85a871 Re-enable future-incompatible tests. 2021-07-16 05:45:29 -07:00
Eric Huss
e7df0d136c Temporarily disable future_incompat tests. 2021-06-29 11:56:03 -07:00
Eric Huss
afe7314ede Don't trigger an update when looking for suggestions. 2021-06-21 09:55:29 -07:00
Eric Huss
a93bfcbdff Print reports using shell to handle old Windows colors properly. 2021-06-21 09:50:42 -07:00
Eric Huss
71cb59b6ef Future-incompat report: Add suggestions of newer versions. 2021-06-21 09:49:43 -07:00
Eric Huss
1f7141f892 Add future-incompat as an alias for future-incompatibilities. 2021-06-21 09:49:43 -07:00
Eric Huss
c2b02b3926 Updates to future-incompatible reporting. 2021-06-21 09:49:41 -07:00
Eric Huss
ff49b829e6 Add report subcommand. 2021-04-30 13:01:21 -07:00
Matthias Krüger
1b7fa21f39 fix clippy warnings
fixes these clippy warnings:

map_collect_result_unit
needless_borrow
needless_return
into_iter_on_ref
manual_flatten
match_like_matches_macro
bool_comparison
2021-04-02 12:30:36 +02:00
bors
58a9613144 Auto merge of #9263 - Aaron1011:zero-incompat-note, r=ehuss
Emit note when `--future-incompat-report` had nothing to report
2021-03-22 22:59:56 +00:00
Aaron Hill
f9512ff822
Emit note when --future-incompat-report had nothing to report 2021-03-14 23:22:51 -04:00
Aaron Hill
63ed725fd8
Add --future-incompat-report support to cargo test
This was missed in the original PR
2021-03-14 15:50:01 -04:00
Eric Huss
9ea3503680 Fix some minor formatting issues. 2021-03-05 14:01:01 -08:00
Aaron Hill
f03d47ce4b
Address review comments 2021-03-04 15:21:16 -05:00
Aaron Hill
6177c6584b
Implement future incompatibility report support
cc rust-lang/rust#71249

This implements the Cargo side of 'Cargo report future-incompat'

Based on feedback from alexcrichton and est31, I'm implemented this a
flag `--future-compat-report` on `cargo check/build/rustc`, rather than
a separate `cargo describe-future-incompatibilities` command. This
allows us to avoid writing additional information to disk (beyond the
pre-existing recording of rustc command outputs).

This PR contains:

* Gating of all functionality behind `-Z report-future-incompat`.
  Without this flag, all user output is unchanged.
* Passing `-Z emit-future-incompat-report` to rustc when
  `-Z report-future-incompat` is enabled
* Parsing the rustc JSON future incompat report, and displaying it
  it a user-readable format.
* Emitting a warning at the end of a build if any crates had
  future-incompat reports
* A `--future-incompat-report` flag, which shows the full report for
  each affected crate.
* Tests for all of the above.

At the moment, we can use the `array_into_iter` to write a test.
However, we might eventually get to a point where rustc is not currently
emitting future-incompat reports for any lints. What would we want the
cargo tests to do in this situation?

This functionality didn't require any significant internal changes to
Cargo, with one exception: we now process captured command output for
all units, not just ones where we want to display warnings. This may
result in a slightly longer time to run `cargo build/check/rustc` from
a full cache. since we do slightly more work for each upstream
dependency. Doing this seems unavoidable with the current architecture,
since we need to process captured command outputs to detect
any future-incompat-report messages that were emitted.
2021-03-04 15:21:15 -05:00