]> git.proxmox.com Git - cargo.git/log
cargo.git
21 months agoRe-enable version_works_without_rustc on windows.
Eric Huss [Tue, 2 Aug 2022 19:54:16 +0000 (12:54 -0700)]
Re-enable version_works_without_rustc on windows.

This test was ignored in https://github.com/rust-lang/cargo/pull/3189
without much discussion of explaining why.

AFAICT, this test works fine on Windows on both MSVC and GNU.
Empty paths do the expected behavior (preventing cargo from running
rustc). There are some special rules on Windows about discovering the
process to run (such as searching the app's launch directory), but
I do not think that is relevant here. Confirmed by trying to run
`cargo check` in this test fails to find `rustc`.

21 months agoRe-enable killing_cargo_releases_the_lock on windows.
Eric Huss [Tue, 2 Aug 2022 19:30:42 +0000 (12:30 -0700)]
Re-enable killing_cargo_releases_the_lock on windows.

AFAICT, we do not test on these older platforms anymore.
Regardless, the test seems to work fine on 32-bit windows-gnu
on Windows 10.

See https://github.com/rust-lang/cargo/pull/3102#issuecomment-260815269
where it was originally disabled.

21 months agoAuto merge of #10918 - ehuss:fix-formats_source, r=Eh2406
bors [Tue, 2 Aug 2022 14:41:51 +0000 (14:41 +0000)]
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.

21 months agoAuto merge of #10921 - ehuss:disable-scrape_examples_complex_reverse_dependencies...
bors [Tue, 2 Aug 2022 13:59:13 +0000 (13:59 +0000)]
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`

21 months agoDisable scrape_examples_complex_reverse_dependencies
Eric Huss [Tue, 2 Aug 2022 13:42:36 +0000 (06:42 -0700)]
Disable scrape_examples_complex_reverse_dependencies

21 months agoProvide better error information if rustfmt fails.
Eric Huss [Tue, 2 Aug 2022 04:23:17 +0000 (21:23 -0700)]
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.

21 months agoFix formats_source test requiring rustfmt.
Eric Huss [Tue, 2 Aug 2022 04:07:19 +0000 (21:07 -0700)]
Fix formats_source test requiring rustfmt.

21 months agoAuto merge of #10916 - ehuss:contrib-shortcuts, r=weihanglo
bors [Mon, 1 Aug 2022 04:50:41 +0000 (04:50 +0000)]
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).

21 months agoContrib: Add docs on the rustbot ready command
Eric Huss [Mon, 1 Aug 2022 03:52:30 +0000 (20:52 -0700)]
Contrib: Add docs on the rustbot ready command

21 months agoAuto merge of #10844 - yerke:yerke/negative_jobs, r=ehuss
bors [Mon, 1 Aug 2022 03:41:10 +0000 (03:41 +0000)]
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.

21 months agoMerge branch 'master' into yerke/negative_jobs
Yerkebulan Tulibergenov [Mon, 1 Aug 2022 01:21:33 +0000 (18:21 -0700)]
Merge branch 'master' into yerke/negative_jobs

21 months agoAuto merge of #9892 - ehuss:cargo_test-ignore-reason, r=weihanglo
bors [Mon, 1 Aug 2022 00:51:01 +0000 (00:51 +0000)]
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.

21 months agoDrop check for mingw32-make.
Eric Huss [Sun, 31 Jul 2022 22:57:24 +0000 (15:57 -0700)]
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.

21 months agoRemove needless is_not_nightly closure.
Eric Huss [Sun, 31 Jul 2022 22:28:31 +0000 (15:28 -0700)]
Remove needless is_not_nightly closure.

21 months agoFix typos in cargo_test docs.
Eric Huss [Sun, 31 Jul 2022 22:19:37 +0000 (15:19 -0700)]
Fix typos in cargo_test docs.

21 months agoAdd missing `requires_git` requirements.
Eric Huss [Sun, 31 Jul 2022 22:19:17 +0000 (15:19 -0700)]
Add missing `requires_git` requirements.

21 months agoremove duplicate check
Yerkebulan Tulibergenov [Sun, 31 Jul 2022 21:34:34 +0000 (14:34 -0700)]
remove duplicate check

21 months agoRemove CARGO_TEST_DISABLE_GIT_CLI
Eric Huss [Sun, 31 Jul 2022 02:36:30 +0000 (19:36 -0700)]
Remove CARGO_TEST_DISABLE_GIT_CLI

This appears to no longer be necessary since we have migrated to
GitHub Actions.

21 months agoAdd requirements to cargo_test.
Eric Huss [Thu, 9 Sep 2021 06:10:33 +0000 (23:10 -0700)]
Add requirements to cargo_test.

22 months agoAuto merge of #10913 - ehuss:contrib-submodule, r=epage
bors [Sat, 30 Jul 2022 05:44:11 +0000 (05:44 +0000)]
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.

22 months agoAuto merge of #10912 - ehuss:contrib-crater, r=epage
bors [Sat, 30 Jul 2022 05:04:42 +0000 (05:04 +0000)]
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.

22 months agoAuto merge of #10914 - ehuss:contrib-new-release, r=epage
bors [Sat, 30 Jul 2022 04:17:39 +0000 (04:17 +0000)]
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.

22 months agoContrib: Document submodule update process
Eric Huss [Sat, 30 Jul 2022 00:34:11 +0000 (17:34 -0700)]
Contrib: Document submodule update process

22 months agoContrib: Document new-release process
Eric Huss [Sat, 30 Jul 2022 00:44:16 +0000 (17:44 -0700)]
Contrib: Document new-release process

22 months agoContrib: Add docs on how to use crater
Eric Huss [Sat, 30 Jul 2022 00:11:00 +0000 (17:11 -0700)]
Contrib: Add docs on how to use crater

22 months agoAuto merge of #10911 - Nemo157:override-to-resolver-1, r=epage
bors [Fri, 29 Jul 2022 14:50:51 +0000 (14:50 +0000)]
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.

22 months agoOverride to resolver=1 in published package
Wim Looman [Fri, 29 Jul 2022 09:37:25 +0000 (11:37 +0200)]
Override to resolver=1 in published package

22 months agoAuto merge of #10902 - epage:lock, r=ehuss
bors [Wed, 27 Jul 2022 20:39:51 +0000 (20:39 +0000)]
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

22 months agofix(add): Update the lock file
Ed Page [Mon, 25 Jul 2022 15:11:50 +0000 (10:11 -0500)]
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

22 months agotest(add): Make test data valid
Ed Page [Mon, 25 Jul 2022 16:03:55 +0000 (11:03 -0500)]
test(add): Make test data valid

Resolving the manifests will fail due to inconsistencies.  This
addresses those.

22 months agofix(add): Respect --locked
Ed Page [Mon, 25 Jul 2022 14:51:58 +0000 (09:51 -0500)]
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.

22 months agoAuto merge of #10899 - ehuss:empty-wrapper-test, r=weihanglo
bors [Sun, 24 Jul 2022 21:10:46 +0000 (21:10 +0000)]
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.

22 months agoAuto merge of #10896 - RalfJung:rustc-wrapper, r=ehuss
bors [Sun, 24 Jul 2022 20:13:57 +0000 (20:13 +0000)]
Auto merge of #10896 - RalfJung:rustc-wrapper, r=ehuss

expand RUSTC_WRAPPER docs

Fixes https://github.com/rust-lang/cargo/issues/10886

22 months agoMake the empty rustc-wrapper test more explicit.
Eric Huss [Sun, 24 Jul 2022 20:10:35 +0000 (13:10 -0700)]
Make the empty rustc-wrapper test more explicit.

22 months agoexpand RUSTC_WRAPPER docs
Ralf Jung [Sun, 24 Jul 2022 02:56:55 +0000 (22:56 -0400)]
expand RUSTC_WRAPPER docs

22 months agoAuto merge of #10859 - Muscraft:stabilize-workspace-inheritance, r=epage
bors [Sat, 23 Jul 2022 17:14:50 +0000 (17:14 +0000)]
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

22 months agoStabilize workspace inheritance
Scott Schafer [Sat, 23 Jul 2022 14:36:49 +0000 (09:36 -0500)]
Stabilize workspace inheritance

22 months agoAuto merge of #10890 - joshtriplett:typo, r=weihanglo
bors [Sat, 23 Jul 2022 05:08:50 +0000 (05:08 +0000)]
Auto merge of #10890 - joshtriplett:typo, r=weihanglo

Fix typo in unstable docs: s/PROGJCT/PROJECT/

22 months agoFix typo in unstable docs: s/PROGJCT/PROJECT/
Josh Triplett [Sat, 23 Jul 2022 04:52:44 +0000 (21:52 -0700)]
Fix typo in unstable docs: s/PROGJCT/PROJECT/

22 months agoAuto merge of #10883 - epage:fuzz, r=Eh2406
bors [Thu, 21 Jul 2022 15:13:30 +0000 (15:13 +0000)]
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)

22 months agorefactor(source): Replace bool with enum
Ed Page [Wed, 20 Jul 2022 15:53:53 +0000 (10:53 -0500)]
refactor(source): Replace bool with enum

22 months agorefactor(source): Be consistent with Registry::query_vec
Ed Page [Tue, 19 Jul 2022 22:09:29 +0000 (17:09 -0500)]
refactor(source): Be consistent with Registry::query_vec

22 months agorefactor(source): Make fuzzy a param, like registry
Ed Page [Wed, 20 Jul 2022 15:11:53 +0000 (10:11 -0500)]
refactor(source): Make fuzzy a param, like registry

22 months agorefactor(registry): Move query out-param to be last
Ed Page [Tue, 19 Jul 2022 21:59:04 +0000 (16:59 -0500)]
refactor(registry): Move query out-param to be last

22 months agoAuto merge of #10879 - dcaba:master, r=epage
bors [Tue, 19 Jul 2022 13:59:17 +0000 (13:59 +0000)]
Auto merge of #10879 - dcaba:master, r=epage

docs: fixing minor error in the default timing report filename

### What does this PR try to resolve?

Minor documentation fix, as I accidentally realized that the timings build report filename is not plural.

22 months agodocs: fixing minor error in the default timing report filename
Daniel Caballero Rodriguez [Tue, 19 Jul 2022 12:48:07 +0000 (14:48 +0200)]
docs: fixing minor error in the default timing report filename

22 months agoAuto merge of #10838 - weihanglo:stabilize-crate-type, r=ehuss
bors [Sun, 17 Jul 2022 20:15:52 +0000 (20:15 +0000)]
Auto merge of #10838 - weihanglo:stabilize-crate-type, r=ehuss

Stabilize `--crate-type` flag for `cargo rustc`

22 months agoMerge branch 'master' into stabilize-crate-type
Eric Huss [Sun, 17 Jul 2022 20:14:44 +0000 (13:14 -0700)]
Merge branch 'master' into stabilize-crate-type

22 months agoAuto merge of #10766 - weihanglo:stabilize-multitarget, r=ehuss
bors [Sun, 17 Jul 2022 18:49:35 +0000 (18:49 +0000)]
Auto merge of #10766 - weihanglo:stabilize-multitarget, r=ehuss

Stabilize `-Zmultitarget`

22 months agoAuto merge of #10874 - weihanglo:cleanup-unstable, r=ehuss
bors [Sun, 17 Jul 2022 18:05:09 +0000 (18:05 +0000)]
Auto merge of #10874 - weihanglo:cleanup-unstable, r=ehuss

Clean up leftover in unstable documentation

### What does this PR try to resolve?

- Fix the name of the link to `--keep-going` original issue.
- Clean up leftover of `strip` option in unstable documentation.

22 months agoUpdate docs for -Zmultitarget stabilization
Weihang Lo [Fri, 17 Jun 2022 14:56:42 +0000 (22:56 +0800)]
Update docs for -Zmultitarget stabilization

22 months agoUpdate tests to reflect -Zmultitarget stabilization
Weihang Lo [Fri, 17 Jun 2022 11:53:12 +0000 (19:53 +0800)]
Update tests to reflect -Zmultitarget stabilization

22 months agoStabilize -Zmultitarget
Weihang Lo [Fri, 17 Jun 2022 11:38:26 +0000 (19:38 +0800)]
Stabilize -Zmultitarget

22 months agoRemove "Profile `strip`" from unstable features list
Weihang Lo [Fri, 17 Jun 2022 23:32:39 +0000 (07:32 +0800)]
Remove "Profile `strip`" from unstable features list

It has been stabilized since 1.59

22 months agoFix link name of tracking issue `keep-going`
Weihang Lo [Fri, 17 Jun 2022 06:20:17 +0000 (14:20 +0800)]
Fix link name of tracking issue `keep-going`

22 months agoAuto merge of #10668 - weihanglo:issue-10652, r=ehuss
bors [Sat, 16 Jul 2022 22:41:57 +0000 (22:41 +0000)]
Auto merge of #10668 - weihanglo:issue-10652, r=ehuss

Normalize path for `cargo vendor` output

22 months agoExplain why normalizing slashes on vendor config output
Weihang Lo [Sat, 16 Jul 2022 22:39:24 +0000 (23:39 +0100)]
Explain why normalizing slashes on vendor config output

22 months agoUpdate doc for `--crate-type` flag
Weihang Lo [Sat, 9 Jul 2022 11:36:07 +0000 (12:36 +0100)]
Update doc for `--crate-type` flag

22 months agoStabilize `--crate-type` flag for `cargo rust`
Weihang Lo [Sat, 9 Jul 2022 11:34:44 +0000 (12:34 +0100)]
Stabilize `--crate-type` flag for `cargo rust`

22 months agoAuto merge of #10868 - Muscraft:add-reason-for-nightly-tests, r=ehuss
bors [Sat, 16 Jul 2022 18:36:58 +0000 (18:36 +0000)]
Auto merge of #10868 - Muscraft:add-reason-for-nightly-tests, r=ehuss

add a reason to `masquerade_as_nightly_cargo` so it is searchable

When I was working on the stabilization for workspace inheritance, it was very tedious to find all of the places to remove `.masquerade_as_nightly_cargo()`. I [suggested](https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/problems.20finding.20.60.2Emasquerade_as_nightly_cargo.28.29.60) to add a reason to `.masquerade_as_nightly_cargo()` so that it would be easier to find all of the places to remove it. By adding the reason it makes it easy to search for all places with the features name. This PR adds the reason(s) to all of the places `.masquerade_as_nightly_cargo()` is called, as well as updates the documentation so it talks about adding a reason when making the call.

22 months agoadd a reason to `masquerade_as_nightly_cargo` so it is searchable
Scott Schafer [Sat, 16 Jul 2022 02:32:23 +0000 (21:32 -0500)]
add a reason to `masquerade_as_nightly_cargo` so it is searchable

22 months agoAuto merge of #10784 - tedinski:fix-10783, r=epage
bors [Sat, 16 Jul 2022 02:32:05 +0000 (02:32 +0000)]
Auto merge of #10784 - tedinski:fix-10783, r=epage

Allow '.' in workspace.default-members in non-virtual workspaces.

22 months agoAuto merge of #10867 - Muscraft:remove-unneeded-nightly-from-tests, r=ehuss
bors [Fri, 15 Jul 2022 01:24:25 +0000 (01:24 +0000)]
Auto merge of #10867 - Muscraft:remove-unneeded-nightly-from-tests, r=ehuss

remove`.masquerade_as_nightly_cargo()` from various tests the no longer need it

When looking at making [`.masquerade_as_nightly_cargo()` take in a list of reasons](https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/problems.20finding.20.60.2Emasquerade_as_nightly_cargo.28.29.60), I found various tests that no longer needed `.masquerade_as_nightly_cargo()`. This removes it from all of the offending tests.

I tried my best to find all tests that no longer need it but I could have missed one or two.

22 months agoremove unneeded nightly flags from various tests
Scott Schafer [Fri, 15 Jul 2022 00:55:44 +0000 (19:55 -0500)]
remove unneeded nightly flags from various tests

22 months agoAuto merge of #10866 - Muscraft:update-extra-link-tests, r=ehuss
bors [Thu, 14 Jul 2022 20:37:21 +0000 (20:37 +0000)]
Auto merge of #10866 - Muscraft:update-extra-link-tests, r=ehuss

remove `.masquerade_as_nightly_cargo()` from build_script_extra_link_arg.rs

When looking at making [`.masquerade_as_nightly_cargo()` take in a list of reasons](https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/problems.20finding.20.60.2Emasquerade_as_nightly_cargo.28.29.60), I found that [`build_script_extra_link_arg.rs`](https://github.com/rust-lang/cargo/blob/8827baaa781b37872134c1ba692a6f0aeb37890e/tests/testsuite/build_script_extra_link_arg.rs) still was using it. `extra-link-arg` was [stabilized in 1.56.0](https://github.com/rust-lang/cargo/blob/8827baaa781b37872134c1ba692a6f0aeb37890e/src/doc/src/reference/unstable.md#extra-link-arg), so this PR removes `.masquerade_as_nightly_cargo()` from all the tests in this file.

22 months agoremove `.masquerade_as_nightly_cargo()` from build_script_extra_link_arg.rs
Scott Schafer [Thu, 14 Jul 2022 20:05:33 +0000 (15:05 -0500)]
remove `.masquerade_as_nightly_cargo()` from build_script_extra_link_arg.rs

22 months agoAuto merge of #10862 - Muscraft:workspace-selection-test, r=epage
bors [Thu, 14 Jul 2022 02:56:51 +0000 (02:56 +0000)]
Auto merge of #10862 - Muscraft:workspace-selection-test, r=epage

Add a test for regressions in selecting the correct workspace root

This adds a test to check for regressions in selecting the correct workspace when there are nested workspaces.

#10846 solved a problem with nested workspace resolution that was caused by #10776. `@ehuss` [suggested](https://github.com/rust-lang/cargo/pull/10846#issuecomment-1183754728) that a test should be added to ensure that this issue does not pop up again.

I ensured that this worked by testing against commit before #10846. Sporadically I would get an error that was the same as described in #10846.
```
error: package `{path}/cargo/target/tmp/cit/t0/foo/sub/foo/Cargo.toml` is a member of the wrong workspace
expected: {path}/cargo/target/tmp/cit/t0/foo/sub/Cargo.toml
actual:   {path}/cargo/target/tmp/cit/t0/foo/Cargo.toml
```
I then tested it on the commit with the fix and the test passed every time.

---

While this does add a test to catch any regression I am worried that it will not catch it every time.  It was noted in #10846 that this error would sometimes happen but not every time, in my testing I found this to be true as well. Since this is caused by the `HashMap` order changing each run, switching to something ordered like `BTreeMap` **_should_** catch any regressions every run (if the implementation were to ever change). I'm not sure if this is necessary so I figured I would note the concern here.

22 months agoAuto merge of #10861 - RalfJung:cargo-install-debug, r=ehuss
bors [Thu, 14 Jul 2022 02:14:02 +0000 (02:14 +0000)]
Auto merge of #10861 - RalfJung:cargo-install-debug, r=ehuss

clarify profile used for 'cargo install --debug'

TIL that the profile used by `cargo build` is called `dev`, not `debug`. That made me wonder, is that profile also used by `cargo install --debug` (despite the name of the flag being `--debug`, not `--dev`)? Turns out the answer is yes, but the first 2 places where I looked for help did not say that. So this PR changes those two places to be explicit about this.

22 months agoAdd a test to check for regressions in selecting the correct workspace when there...
Scott Schafer [Thu, 14 Jul 2022 02:10:22 +0000 (21:10 -0500)]
Add a test to check for regressions in selecting the correct workspace when there are nested workspaces

22 months agoupdate etc/_cargo
Ralf Jung [Thu, 14 Jul 2022 01:53:09 +0000 (21:53 -0400)]
update etc/_cargo

22 months agoclarify profile used for 'cargo install --debug'
Ralf Jung [Wed, 13 Jul 2022 23:34:37 +0000 (19:34 -0400)]
clarify profile used for 'cargo install --debug'

22 months agoAuto merge of #10860 - Eh2406:4xxDocs, r=ehuss
bors [Wed, 13 Jul 2022 23:44:31 +0000 (23:44 +0000)]
Auto merge of #10860 - Eh2406:4xxDocs, r=ehuss

servers should use 404

Clarify the docs in lieu of our conversation at https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/Sparse.20Registry.20Errors

22 months agodon't doc an old bug
Jacob Finkelman [Wed, 13 Jul 2022 22:25:08 +0000 (18:25 -0400)]
don't doc an old bug

Co-authored-by: Eric Huss <eric@huss.org>
22 months agonot just 404
Jacob Finkelman [Wed, 13 Jul 2022 22:23:29 +0000 (18:23 -0400)]
not just 404

Co-authored-by: Eric Huss <eric@huss.org>
22 months agoFinish updating members via find_path_deps before setting up default_members
Ted Kaminski [Wed, 13 Jul 2022 21:14:47 +0000 (21:14 +0000)]
Finish updating members via find_path_deps before setting up default_members

22 months agoAllow '.' in workspace.default-members in non-virtual workspaces.
Ted Kaminski [Thu, 23 Jun 2022 16:46:35 +0000 (16:46 +0000)]
Allow '.' in workspace.default-members in non-virtual workspaces.

22 months agoservers should use 404
Jacob Finkelman [Wed, 13 Jul 2022 20:47:50 +0000 (20:47 +0000)]
servers should use 404

22 months agoAuto merge of #10849 - epage:inline, r=ehuss
bors [Wed, 13 Jul 2022 20:41:01 +0000 (20:41 +0000)]
Auto merge of #10849 - epage:inline, r=ehuss

test(add): Ensure comments are preserved

A comment on killercup/cargo-edit#15 had me worried that `cargo add` was
deleting comments now.  It appears that isn't the case for inline
tables.

Standard tables however do delete comments.  The work to make sure they
don't conflicts with another need.  When changing the source, we delete
the old source fields and append the new which can cause some formatting
to be carried over unnecessarily.

For example, what would normally look like
```toml
cargo-list-test-fixture-dependency = { optional = true, path = "../dependency", version = "0.0.0" }
```
When fixed to preserve comments with my naive solution looks like
```toml
cargo-list-test-fixture-dependency = { optional = true , path = "../dependency", version = "0.0.0" }
```
Note that `optional = true` used to be last, so space separating it and
`}` was kept, now separating it and `,`.

More work will be needed to get this into an ideal state but we can at
least have confidence with inline tables for now.

22 months agotest(add): Ensure comments are preserved
Ed Page [Mon, 11 Jul 2022 21:14:34 +0000 (16:14 -0500)]
test(add): Ensure comments are preserved

A comment on killercup/cargo-edit#15 had me worried that `cargo add` was
deleting comments now.  It appears that isn't the case for inline
tables.

Standard tables however do delete comments.  The work to make sure they
don't conflicts with another need.  When changing the source, we delete
the old source fields and append the new which can cause some formatting
to be carried over unnecessarily.

For example, what would normally look like
```toml
cargo-list-test-fixture-dependency = { optional = true, path = "../dependency", version = "0.0.0" }
```
When fixed to preserve comments with my naive solution looks like
```toml
cargo-list-test-fixture-dependency = { optional = true , path = "../dependency", version = "0.0.0" }
```
Note that `optional = true` used to be last, so space separating it and
`}` was kept, now separating it and `,`.

More work will be needed to get this into an ideal state but we can at
least have confidence with inline tables for now.

22 months agoAuto merge of #10846 - EmbarkStudios:fix-workspace-resolution, r=epage
bors [Wed, 13 Jul 2022 13:49:36 +0000 (13:49 +0000)]
Auto merge of #10846 - EmbarkStudios:fix-workspace-resolution, r=epage

Fix nested workspace resolution

This fixes a bug that was introduced in #10776 with nested workspaces.

As an example, say we have two workspaces:

`/code/example/Cargo.toml` and `/code/example/sub/Cargo.toml`, and a crate within the `sub` workspace `/code/example/sub/test-crate/Cargo.toml`.

Since the `ws_roots` is a HashMap with randomized ordering, this code will _sometimes_ cause the workspace at `/code/example/Cargo.toml` to be discovered and used _before_ `/code/example/sub/Cargo.toml`,

https://github.com/rust-lang/cargo/blob/b1dd22e668af5279e13a071ad4b17435bd6bfa4c/src/cargo/core/workspace.rs#L1704-L1710

This will then cause the `validate_members` method to fail as the member thinks it is a member of a different workspace than it should be.

https://github.com/rust-lang/cargo/blob/b1dd22e668af5279e13a071ad4b17435bd6bfa4c/src/cargo/core/workspace.rs#L874-L891

This change just makes it so that the input manifest path is walked up to find the (presumably) most appropriate workspace so that the ordering of the `HashMap` doesn't matter.

If you encounter this bug by running cargo nightly, you can workaround it by adding the crate(s) to the `excluded` field in the workspace they don't belong to.

22 months agoCleanup
Jake Shadle [Wed, 13 Jul 2022 06:58:03 +0000 (08:58 +0200)]
Cleanup

22 months agoFix workspace resolution
Jake Shadle [Mon, 11 Jul 2022 09:07:32 +0000 (11:07 +0200)]
Fix workspace resolution

22 months agoAuto merge of #10856 - ehuss:future-incompat-docs, r=epage
bors [Wed, 13 Jul 2022 00:56:43 +0000 (00:56 +0000)]
Auto merge of #10856 - ehuss:future-incompat-docs, r=epage

Small tweaks to the future-incompat docs.

This contains a few changes to the future-incompat docs to try to make it a little clearer how it works, and some formatting and wording changes.

22 months agoSmall tweaks to the future-incompat docs.
Eric Huss [Wed, 13 Jul 2022 00:38:19 +0000 (17:38 -0700)]
Small tweaks to the future-incompat docs.

22 months agoAuto merge of #10847 - johnmatthiggins:master, r=epage
bors [Mon, 11 Jul 2022 15:54:27 +0000 (15:54 +0000)]
Auto merge of #10847 - johnmatthiggins:master, r=epage

Fixed extra period typo

Fixes #10845.

22 months agoFixed extra period typo
John Higgins [Mon, 11 Jul 2022 04:01:03 +0000 (21:01 -0700)]
Fixed extra period typo

22 months agofix the test
Yerkebulan Tulibergenov [Sun, 10 Jul 2022 23:31:24 +0000 (16:31 -0700)]
fix the test

22 months agomake consistent error message
Yerkebulan Tulibergenov [Sun, 10 Jul 2022 23:13:39 +0000 (16:13 -0700)]
make consistent error message

22 months agoupdate man pages
Yerkebulan Tulibergenov [Sun, 10 Jul 2022 23:06:25 +0000 (16:06 -0700)]
update man pages

22 months agoupdate config.md
Yerkebulan Tulibergenov [Sun, 10 Jul 2022 23:02:31 +0000 (16:02 -0700)]
update config.md

22 months agofix value_of_i32
Yerkebulan Tulibergenov [Sun, 10 Jul 2022 21:52:05 +0000 (14:52 -0700)]
fix value_of_i32

22 months agoMerge branch 'master' into yerke/negative_jobs
Yerkebulan Tulibergenov [Sun, 10 Jul 2022 21:20:26 +0000 (14:20 -0700)]
Merge branch 'master' into yerke/negative_jobs

22 months agoAuto merge of #10836 - ehuss:patch-config-docs, r=weihanglo
bors [Sat, 9 Jul 2022 14:48:50 +0000 (14:48 +0000)]
Auto merge of #10836 - ehuss:patch-config-docs, r=weihanglo

Mention `[patch]` config in "Overriding Dependencies"

The "Overriding Dependencies" chapter is the primary documentation for the `[patch]` table, but it does not mention that `[patch]` also works in config files. This adds a note to mention this option.

cc https://github.com/rust-lang/cargo/issues/10832#issuecomment-1177647089

22 months agoAuto merge of #10833 - ehuss:terminal-width-new-flag, r=Eh2406
bors [Sat, 9 Jul 2022 11:05:33 +0000 (11:05 +0000)]
Auto merge of #10833 - ehuss:terminal-width-new-flag, r=Eh2406

Update terminal-width flag.

The rustc flag `-Zterminal-width` has been stabilized as `--terminal-width` in https://github.com/rust-lang/rust/pull/95635. This updates cargo to use the new flag so that tests will pass.

Tests won't pass until the next nightly is published in about 10 hours from now. I just wanted to post this to get ahead of the breaking change.

This doesn't stabilize in cargo because that will take more time, and this is needed to prevent CI from failing. Will continue the stabilization discussion at https://github.com/rust-lang/rust/issues/84673.

22 months agoMention `[patch]` config in "Overriding Dependencies"
Eric Huss [Sat, 9 Jul 2022 00:09:23 +0000 (17:09 -0700)]
Mention `[patch]` config in "Overriding Dependencies"

22 months agoAuto merge of #10835 - arlosi:refactor_yanked, r=ehuss
bors [Fri, 8 Jul 2022 23:39:51 +0000 (23:39 +0000)]
Auto merge of #10835 - arlosi:refactor_yanked, r=ehuss

Refactor check_yanked to avoid some duplication

Follow up from #10830

r? `@ehuss`

22 months agoRefactor check_yanked to avoid some duplication
Arlo Siemsen [Fri, 8 Jul 2022 18:10:44 +0000 (13:10 -0500)]
Refactor check_yanked to avoid some duplication

22 months agoUpdate terminal-width flag.
Eric Huss [Fri, 8 Jul 2022 14:57:40 +0000 (07:57 -0700)]
Update terminal-width flag.

22 months agoAuto merge of #10831 - arlosi:sparse-publish-fix, r=Eh2406
bors [Thu, 7 Jul 2022 18:05:08 +0000 (18:05 +0000)]
Auto merge of #10831 - arlosi:sparse-publish-fix, r=Eh2406

Fix publishing to crates.io with -Z sparse-registry

Attempting to publish a crate to crates.io with `-Z sparse-registry` failed with the following error:

```
error: failed to publish to registry at https://crates.io

Caused by:
  the remote server responded with an error: Dependency `serde` is hosted on another registry. Cross-registry dependencies are not permitted on crates.io.
```

The check in `registry.rs` `dep_registry_id != registry_id` caused the `publish` operation include the crates.io index url in the HTTP request because the id was replaced. The crates.io API seems to require that the `registry` field is not present.

This change fixes the issue by making the `registry` function return the non-replaced crates.io `source_id` only for this case. Other replacement indices of crates.io continue to include the registry URL when publishing.

Tested manually by publishing `arlosi-cargo-test` to crates.io with `-Z sparse-registry`

Fixes #10828
r? `@Eh2406`

22 months agoAuto merge of #10830 - arlosi:parallel_yank, r=Eh2406
bors [Thu, 7 Jul 2022 14:55:56 +0000 (14:55 +0000)]
Auto merge of #10830 - arlosi:parallel_yank, r=Eh2406

Make `is_yanked` return `Poll<>`

The `is_yanked` check performed by `cargo install` and `cargo package` was running sequentially (calling `block_until_ready` after every check).

This change makes `is_yanked` return `Poll<>` and runs the check in parallel, which gives better performance for `cargo install --locked` and `cargo package` when using a sparse registry.

fixes #10821
r? `@ehuss`