12510 Commits

Author SHA1 Message Date
akabinds
5f3ded124f stop mixing of newlines and \n in tests 2022-08-02 19:43:16 -05:00
binds
bda60646af
Merge branch 'master' into better-no-such-subcommand 2022-08-02 17:00:57 -07:00
akabinds
42df87409b fix formatting 2022-08-02 18:27:36 -05:00
akabinds
b2f44de83d implemented requested changes; tests pass 2022-08-02 18:23:55 -05:00
bors
5514f1e0e1 Auto merge of #10931 - ehuss:ignore-hg, r=weihanglo
Always allow hg to be missing on CI.

`hg` isn't installed on rust-lang/rust Docker images, which causes this check to fail.

Rather than trying to carefully enforce the requirements for `hg` being tested, this just ignores the test if it is unavailable on CI. I think this is something that can be revisited if Cargo ever gains more hg support.
2022-08-02 22:51:23 +00:00
Eric Huss
a8e285aa18 Always allow hg to be missing on CI. 2022-08-02 15:18:16 -07:00
akabinds
ba3de81017 Merge branch 'better-no-such-subcommand' of https://github.com/akabinds/cargo into better-no-such-subcommand 2022-08-02 13:01:36 -05:00
akabinds
b55e8d47a9 implemented requested changes; fixed one failing test (need to fix other) 2022-08-02 13:01:32 -05:00
binds
590fa058ec
Merge branch 'rust-lang:master' into better-no-such-subcommand 2022-08-02 08:46:32 -07:00
akabinds
9665334c64 improve error message for when subcommand contains +toolchain 2022-08-02 10:46:03 -05:00
binds
10e9d20d23
Merge branch 'rust-lang:master' into better-no-such-subcommand 2022-08-02 07:56:52 -07:00
akabinds
43507dd96f handling if a subcommand looks like +toolchain. very early implementation; very basic and not final 2022-08-02 09:56:13 -05:00
bors
0fb9e85e45 Auto merge of #10918 - ehuss:fix-formats_source, r=Eh2406
Fix formats_source test requiring rustfmt.

The requirements added in #9892 that `rustfmt` must be present doesn't work in the `rust-lang/rust` environment. There are two issues:

* Cargo is run without using rustup. If you also have rustup installed, the test will fail because the `rustfmt` binary found in `PATH` will fail to choose a toolchain because HOME points to the sandbox home which does not have a rustup configuration.
* rust-lang/rust CI uninstalls rustup, and does not have rustfmt in PATH at all.  It is not practical to make rustfmt available there.

The solution here is to just revert the behavior back to where it was where it checks if it can run `rustfmt` in the sandbox. This should work for anyone who has a normal rustup installation (including Cargo's CI). If running the testsuite without rustup, then the test will be skipped.

This also includes a small enhancement to provide better error information when rustfmt fails.
2022-08-02 14:41:51 +00:00
bors
b1dc94de9e Auto merge of #10921 - ehuss:disable-scrape_examples_complex_reverse_dependencies, r=Eh2406
Disable scrape_examples_complex_reverse_dependencies

The test `scrape_examples_complex_reverse_dependencies` no longer works on the latest nightly. It fails with the error:

```
error[E0433]: failed to resolve: could not resolve path `a::f`
 --> examples/ex.rs:1:13
  |
1 | fn main() { a::f(); }
  |             ^^^^ could not resolve path `a::f`
  |
  = note: this error was originally ignored because you are running `rustdoc`
  = note: try running again with `rustc` or `cargo check` and you may get a more detailed error

error: Compilation failed, aborting rustdoc

For more information about this error, try `rustc --explain E0433`.
error: could not document `foo`
```

It is not clear to me what this test was trying to exercise, so I'm not sure how to fix it.  It has an example that is trying to call a function from a proc-macro, but proc-macros do not export functions.

Disabling for now to get CI passing.

cc `@willcrichton`
2022-08-02 13:59:13 +00:00
Eric Huss
e8d92919cf Disable scrape_examples_complex_reverse_dependencies 2022-08-02 06:57:34 -07:00
Eric Huss
f62ce1e3e2 Provide better error information if rustfmt fails.
This uses ProcessBuilder which provides much better error information
(stdout and stderr).  It's also less code, which is a bonus.
2022-08-01 21:23:17 -07:00
Eric Huss
15f9c2dc06 Fix formats_source test requiring rustfmt. 2022-08-01 21:07:19 -07:00
bors
3ccf7dc93b Auto merge of #10916 - ehuss:contrib-shortcuts, r=weihanglo
Contrib: Add docs on the rustbot ready command

This adds some brief docs on the use of ``@rustbot`` [shortcuts](https://github.com/rust-lang/triagebot/wiki/Shortcuts).
2022-08-01 04:50:41 +00:00
Eric Huss
a9ece2518c Contrib: Add docs on the rustbot ready command 2022-07-31 20:53:59 -07:00
bors
223e84a981 Auto merge of #10844 - yerke:yerke/negative_jobs, r=ehuss
Support for negative --jobs parameter, counting backwards from max CPUs

Fixes #9217.

Continuation of https://github.com/rust-lang/cargo/pull/9221.
2022-08-01 03:41:10 +00:00
Yerkebulan Tulibergenov
767368fd02 Merge branch 'master' into yerke/negative_jobs 2022-07-31 18:21:33 -07:00
bors
2e35678c39 Auto merge of #9892 - ehuss:cargo_test-ignore-reason, r=weihanglo
Add requirements to cargo_test.

This extends the `#[cargo_test]` attribute to support some additional requirements to control whether or not a test can run. The motivation for this is:

* Can more clearly see when a test is disabled when it prints "ignored"
* Can more easily scan for disabled tests when I do version bumps to see which ones should be enabled on stable (to pass on CI).

The form is a comma separated list of requirements, and if they don't pass the test is ignored.  The requirements can be:

* `nightly` — The test only runs on nightly.
* `>=1.55` — The test only runs on rustc with the given version or newer.
* `requires_git` — Requires the given command to be installed.  Can be things like `requires_rustfmt` or `requires_hg`, etc.

This also enforces that the author must write a reason why it is ignored (for some of the requirements) so that when I look for tests to update, I know why it is disabled.

This also removes the `CARGO_TEST_DISABLE_GIT_CLI` option, which appears to no longer be necessary since we have migrated to GitHub Actions.
2022-08-01 00:51:01 +00:00
Eric Huss
8e35e2f044 Drop check for mingw32-make.
From what I can tell, it is no longer necessary on GitHub Actions.
This removes it to help simplify things.
2022-07-31 16:06:25 -07:00
Eric Huss
7858bebb0e Remove needless is_not_nightly closure. 2022-07-31 15:28:31 -07:00
Eric Huss
0264a36ea2 Fix typos in cargo_test docs. 2022-07-31 15:19:37 -07:00
Eric Huss
bcf982cf24 Add missing requires_git requirements. 2022-07-31 15:19:17 -07:00
Yerkebulan Tulibergenov
7c932a4713 remove duplicate check 2022-07-31 14:34:34 -07:00
Eric Huss
9d43ffc02a Remove CARGO_TEST_DISABLE_GIT_CLI
This appears to no longer be necessary since we have migrated to
GitHub Actions.
2022-07-30 19:36:58 -07:00
Eric Huss
1c3640e05c Add requirements to cargo_test. 2022-07-30 19:36:58 -07:00
bors
85e79fcc29 Auto merge of #10913 - ehuss:contrib-submodule, r=epage
Contrib: Document submodule update process

This adds some contributor documentation on the process I use to update the cargo submodule.

Of course nobody is required to use this process, but I find it works fairly smoothly.
2022-07-30 05:44:11 +00:00
bors
de22d8646f Auto merge of #10912 - ehuss:contrib-crater, r=epage
Contrib: Add docs on how to use crater

This adds some contributor documentation on how to run crater with cargo changes.
2022-07-30 05:04:42 +00:00
bors
1c2f23138d Auto merge of #10914 - ehuss:contrib-new-release, r=epage
Contrib: Document new-release process

This adds some contributor documentation on the process I use to bump the version and update the changelog. In case I am unavailable to create the changelog, it may perhaps be useful to someone.

Of course nobody is required to use this process, but I find it works fairly smoothly. However, the tool I use is a hacked together script, and may have some hard-coded things, so it may need some work to be useful to others.
2022-07-30 04:17:39 +00:00
Eric Huss
1762b336b7 Contrib: Document submodule update process 2022-07-29 18:05:41 -07:00
Eric Huss
9a65859846 Contrib: Document new-release process 2022-07-29 17:44:16 -07:00
Eric Huss
7e246e970c Contrib: Add docs on how to use crater 2022-07-29 17:34:30 -07:00
bors
281989fb2d Auto merge of #10911 - Nemo157:override-to-resolver-1, r=epage
Override to resolver=1 in published package

As discussed in #10112 this avoids inconsistent dependency resolution in development and packaged builds when an edition 2021 crate is published from a workspace using the default resolver=1.
2022-07-29 14:50:51 +00:00
Wim Looman
d953c3b2d7
Override to resolver=1 in published package 2022-07-29 16:03:05 +02:00
bors
015143c4d4 Auto merge of #10902 - epage:lock, r=ehuss
fix(add): Update the lock file

This is done in the command, rather than in the op,
- To consistently construct the `Workspace`
- It is more composable as an API

A downside is we update the git dependencies a second time and any sources we didn't initially update.

Unlike the proposal in the attached issue, this does not roll back on error.
- For some errors, the user might want to debug what went wrong.  Losing the intermediate state makes that difficult
- Rollback adds its own complications and risks, including since its
  non-atomic

We've already tried to address most potential errors during `cargo add`s processing.  To meet this desire, we now error if `--locked` is passed in and we would change the manifest.  See that individual commit's message for more details.

Fixes #10901
2022-07-27 20:39:51 +00:00
Ed Page
5789c12e45 fix(add): Update the lock file
This is done in the command, rather than in the op,
- To consistently construct the `Workspace`
- It is more composable as an API

A downside is we update the git dependencies a second time.

We are not rolling back on error.
- For some errors, the user might want to debug what went wrong
- Rollback adds its own complications and risks, including since its
  non-atomic

Fixes #10901
2022-07-26 14:59:07 -05:00
Ed Page
323c7bc306 test(add): Make test data valid
Resolving the manifests will fail due to inconsistencies.  This
addresses those.
2022-07-25 11:06:12 -05:00
Ed Page
b5c4a765ef fix(add): Respect --locked
This is prep for #10901 to avoid the most common failure case for the
lock file.  We are assuming if the users action caused a change in the
manifes, then it will cause a change in the lock file.  This isn't
entirely true but close enough and I think these semantics can make
sense.
2022-07-25 09:52:00 -05:00
bors
85b500ccad Auto merge of #10899 - ehuss:empty-wrapper-test, r=weihanglo
Make the empty rustc-wrapper test more explicit.

This changes the test for an empty RUSTC_WRAPPER environment variable to make it explicit that it doesn't just ignore the environment variable, but that it also essentially unsets any config-loaded value.  It's not clear if this implication was known at the time it was added in #5985, but I don't think we can change it, and it can be useful.
2022-07-24 21:10:46 +00:00
bors
27f4f0243f Auto merge of #10896 - RalfJung:rustc-wrapper, r=ehuss
expand RUSTC_WRAPPER docs

Fixes https://github.com/rust-lang/cargo/issues/10886
2022-07-24 20:13:57 +00:00
Eric Huss
8a487abedd Make the empty rustc-wrapper test more explicit. 2022-07-24 13:10:35 -07:00
Ralf Jung
c492216da0 expand RUSTC_WRAPPER docs 2022-07-24 09:02:37 -04:00
bors
ba5b1920c4 Auto merge of #10859 - Muscraft:stabilize-workspace-inheritance, r=epage
Stabilize Workspace Inheritance

What does this PR try to resolve?

Stabilize Workspace Inheritance as [#8415 (comment)](https://github.com/rust-lang/cargo/issues/8415#issuecomment-1182638594) concluded.

Close #8415
2022-07-23 17:14:50 +00:00
Scott Schafer
2c810afda9 Stabilize workspace inheritance 2022-07-23 09:36:49 -05:00
bors
168747c028 Auto merge of #10890 - joshtriplett:typo, r=weihanglo
Fix typo in unstable docs: s/PROGJCT/PROJECT/
2022-07-23 05:08:50 +00:00
Josh Triplett
a5b241a5c4 Fix typo in unstable docs: s/PROGJCT/PROJECT/ 2022-07-22 21:52:44 -07:00
bors
caf3c37d90 Auto merge of #10883 - epage:fuzz, r=Eh2406
refactor(source): Open query API for adding more types of queries

### What does this PR try to resolve?

This refactors the Source/Registry traits from accepting a `fuzzy: bool` to accepting an enum so we can add alternative query styles in the future, as discussed in the Cargo team meeting for fixing #10729

The expected fix for `cargo add` at this point would be
- Add `QueryKind::Normalized`
  - Initially, we can make it like Exact for path sources and like Fuzzy for registry sources
- Switch cargo-add to using that kind everywhere (both where `Exact` and `Fuzzy` are used)
- A test to ensure this fixed it
- Rename `Fuzzy` to `Alternatives` or something to clarify its actual intent

### How should we test and review this PR?

The refactor is broken down into multiple commits, so ideally review a commit at a time to more easily see how it evolved.

### Additional information

Future possibilities
- Supporting normalized search on all sources
- Doing version / source matching for normalized results (probably not needed for cargo-add but will make the API less surprising for future users)
2022-07-21 15:13:30 +00:00