]> git.proxmox.com Git - cargo.git/log
cargo.git
21 months agoAuto merge of #10968 - hi-rustin:rustin-patch-msg, r=ehuss
bors [Thu, 11 Aug 2022 03:23:09 +0000 (03:23 +0000)]
Auto merge of #10968 - hi-rustin:rustin-patch-msg, r=ehuss

Improve error msg for get target runner

Actually, we'll get this config from three places. So this msg may be confusing when you set it up in `.cargo/config.toml` or pass it by `--config`.
We already printed the location of the config, so I think it's OK to change it to `configurations`.

21 months agoAuto merge of #10962 - Nemo157:override-target-dir, r=ehuss
bors [Wed, 10 Aug 2022 21:55:46 +0000 (21:55 +0000)]
Auto merge of #10962 - Nemo157:override-target-dir, r=ehuss

Ensure rustc-echo-wrapper works with an overridden build.target-dir

Without this when running with an overridden target-dir there are about a dozen test failures like

```console
> mkdir .cargo
> echo '[build]\ntarget-dir = "not-target"' > .cargo/config
> cargo test -- fix::does_not_crash
---- fix::does_not_crash_with_rustc_wrapper stdout ----
running `/home/nemo157/sources/cargo/not-target/debug/cargo build`
running `/home/nemo157/sources/cargo/not-target/debug/cargo fix --allow-no-vcs`
thread 'fix::does_not_crash_with_rustc_wrapper' panicked at '
test failed running `/home/nemo157/sources/cargo/not-target/debug/cargo fix --allow-no-vcs`
error: process exited with code 101 (expected 0)
--- stdout

--- stderr
error: failed to run `rustc` to learn about target-specific information

Caused by:
  could not execute process `/home/nemo157/sources/cargo/not-target/tmp/cit/rustc-echo-wrapper/target/debug/rustc-echo-wrapper rustc - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (never executed)

Caused by:
  No such file or directory (os error 2)
', tests/testsuite/fix.rs:1228:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

Because the `rustc-echo-wrapper` is compiled to `not-target/debug/rustc-echo-wrapper`.

This is resolved by forcing the target-dir to be a manifest-relative one for this specific build.

21 months agoAuto merge of #10969 - joshtriplett:available-parallelism, r=epage
bors [Wed, 10 Aug 2022 17:52:21 +0000 (17:52 +0000)]
Auto merge of #10969 - joshtriplett:available-parallelism, r=epage

Switch back to `available_parallelism`

This reverts commit 8345cf5037506b38457483429fb113322c58f668 now that https://github.com/rust-lang/rust/pull/97925 is merged.

Since that
time, there are now multiple calls to get the number of CPUs, to handle
the `-j -NUM` case, so factor out a helper function.

21 months agoSwitch back to `available_parallelism`
Josh Triplett [Wed, 10 Aug 2022 15:49:24 +0000 (17:49 +0200)]
Switch back to `available_parallelism`

This reverts commit 8345cf5037506b38457483429fb113322c58f668. Since that
time, there are now multiple calls to get the number of CPUs, to handle
the `-j -NUM` case, so factor out a helper function.

21 months agoEnsure rustc-echo-wrapper works with an overridden build.target-dir
Wim Looman [Fri, 29 Jul 2022 13:56:30 +0000 (15:56 +0200)]
Ensure rustc-echo-wrapper works with an overridden build.target-dir

21 months agoFix test
hi-rustin [Wed, 10 Aug 2022 15:19:35 +0000 (23:19 +0800)]
Fix test

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
21 months agoImprove error msg for get target runner
hi-rustin [Wed, 10 Aug 2022 14:43:00 +0000 (22:43 +0800)]
Improve error msg for get target runner

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
21 months agoAuto merge of #10961 - Nemo157:skip-implicit-override, r=epage
bors [Wed, 10 Aug 2022 14:30:11 +0000 (14:30 +0000)]
Auto merge of #10961 - Nemo157:skip-implicit-override, r=epage

Only override published resolver when the workspace is different

### What does this PR try to resolve?

Ensures when publishing a package that uses an implicit `resolver = "1"` to maintain an MSRV before the `resolver` key was stabilized the implicitness is retained rather than being turned into an explicit setting.

fixes #10954 (assuming that the workspace and its packages are configured with a consistent resolver)

21 months agoAuto merge of #10967 - hi-rustin:rustin-patch-docs, r=epage
bors [Wed, 10 Aug 2022 13:47:46 +0000 (13:47 +0000)]
Auto merge of #10967 - hi-rustin:rustin-patch-docs, r=epage

Add `CARGO_LOG` to "Environment variables Cargo reads"

### What does this PR try to resolve?
close https://github.com/rust-lang/cargo/issues/10947

21 months agoAdd `CARGO_LOG` to `Environment variables Cargo reads`
hi-rustin [Wed, 10 Aug 2022 12:51:28 +0000 (20:51 +0800)]
Add `CARGO_LOG` to `Environment variables Cargo reads`

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
21 months agoOnly override published resolver when the workspace is different
Wim Looman [Fri, 29 Jul 2022 10:07:27 +0000 (12:07 +0200)]
Only override published resolver when the workspace is different

21 months agoAuto merge of #10891 - joshtriplett:rust-version-recommend-precise, r=ehuss
bors [Tue, 9 Aug 2022 22:32:17 +0000 (22:32 +0000)]
Auto merge of #10891 - joshtriplett:rust-version-recommend-precise, r=ehuss

Make the `rust-version` error recommend `cargo update --precise -p crate@ver`

People encountering a dependency with a newer `rust-version` requirement
may not know about `cargo update --precise`, or may consider alternate
approaches that may be harmful (such as pinning with a `=` dependency).

Provide specific guidance in the error message.

21 months agoHave `Edition` know what its default resolver behaviour is
Wim Looman [Fri, 29 Jul 2022 10:07:27 +0000 (12:07 +0200)]
Have `Edition` know what its default resolver behaviour is

21 months agoOnly show advice to use `cargo update --precise` for non-local packages
Josh Triplett [Tue, 2 Aug 2022 17:50:46 +0000 (10:50 -0700)]
Only show advice to use `cargo update --precise` for non-local packages

Packages in the local workspace can't get updated this way; the user
just needs to point to a different source, or otherwise update the
package themselves.

21 months agoMake the `rust-version` error recommend `cargo update -p crate@ver --precise ...`
Josh Triplett [Sat, 23 Jul 2022 06:52:49 +0000 (23:52 -0700)]
Make the `rust-version` error recommend `cargo update -p crate@ver --precise ...`

People encountering a dependency with a newer `rust-version` requirement
may not know about `cargo update --precise`, or may consider alternate
approaches that may be harmful (such as pinning with a `=` dependency).

Provide specific guidance in the error message.

If the user is using `cargo install`, suggest `cargo install --locked` instead.

21 months agoAdd unit test for invalid authors, refactor name
Ky Phan [Mon, 8 Aug 2022 15:05:43 +0000 (22:05 +0700)]
Add unit test for invalid authors, refactor name

21 months agoAuto merge of #10946 - RalfJung:docs, r=epage
bors [Sat, 6 Aug 2022 22:45:31 +0000 (22:45 +0000)]
Auto merge of #10946 - RalfJung:docs, r=epage

resolver docs: link to version requirements syntax full explanation

Staring at https://doc.rust-lang.org/cargo/reference/resolver.html#semver-compatibility, I was confused was this is a "refresher" for. Let's add a link to the main documentation this summarizes.

21 months agoresolver docs: link to version requirements syntax full explanation
Ralf Jung [Sat, 6 Aug 2022 21:01:59 +0000 (17:01 -0400)]
resolver docs: link to version requirements syntax full explanation

21 months agoAuto merge of #10943 - hi-rustin:rustin-patch-bump, r=epage
bors [Sat, 6 Aug 2022 15:14:30 +0000 (15:14 +0000)]
Auto merge of #10943 - hi-rustin:rustin-patch-bump, r=epage

Bump os_info to 3.5.0

close https://github.com/rust-lang/cargo/issues/10940

21 months agoImprove error message for an array
Ky Phan [Sat, 6 Aug 2022 06:52:39 +0000 (13:52 +0700)]
Improve error message for an array

21 months agoBump os_info to 3.5.0
hi-rustin [Sat, 6 Aug 2022 05:12:20 +0000 (13:12 +0800)]
Bump os_info to 3.5.0

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
21 months agoAuto merge of #10941 - hi-rustin:rustin-patch-docs, r=weihanglo
bors [Fri, 5 Aug 2022 23:46:48 +0000 (23:46 +0000)]
Auto merge of #10941 - hi-rustin:rustin-patch-docs, r=weihanglo

Mark --timings=html unstable in the document

### What does this PR try to resolve?

Mark -timings=html unstable in the document. The document was confusing because if you try `--timings=html` it still requires the unstable flag.

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

Check out the document.

### Additional information

Other information you want to mention in this PR, such as prior arts,
future extensions, an unresolved problem, or a TODO list.

21 months agoMark -timings=html unstable in the document
hi-rustin [Fri, 5 Aug 2022 11:39:13 +0000 (19:39 +0800)]
Mark -timings=html unstable in the document

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
21 months agoAuto merge of #10935 - har7an:patch-1, r=epage
bors [Thu, 4 Aug 2022 13:59:45 +0000 (13:59 +0000)]
Auto merge of #10935 - har7an:patch-1, r=epage

Mention that aliases are recursive

Instead of duplicating portions of commands that are used identically across many aliases, the user can instead reuse any previously defined aliases.

### What does this PR try to resolve?

Today I started working with [`xtask`](https://github.com/matklad/cargo-xtask/), which is a build system based on a simple cargo alias:

```toml
[alias]
xtask = "run --package xtask --"
```

Since the word "xtask" is rather difficult to type in my opinion (at least my left hand struggles quite a bit) I wanted to add another alias, `x` as a shorthand (similar to what `build`, `run`, etc. have by default). Thereby I discovered that I needn't replicate the whole alias, because aliases are recursive. I consulted the docs and couldn't find a mention of this, hence I'm adding it as part of this PR so other users can discover it.

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

I don't think this requires a separate test, it's a minor change to the documentation only.

### Additional information

21 months agoMention that aliases are recursive
har7an [Wed, 3 Aug 2022 14:56:01 +0000 (14:56 +0000)]
Mention that aliases are recursive

Instead of duplicating portions of commands that are used identically
across many aliases, the user can instead reuse any previously defined
aliases.

21 months agoAuto merge of #10322 - eholk:reserved-windows-name, r=ehuss
bors [Thu, 4 Aug 2022 00:32:49 +0000 (00:32 +0000)]
Auto merge of #10322 - eholk:reserved-windows-name, r=ehuss

Test if reserved filenames are allowed in Windows

Recent versions of Windows have removed the limitation on filenames like `aux` or `con`. This change allows the `package::reserved_windows_name` to still pass by first trying to create a file with a reserved name to see if Windows supports it. If so, it skips the rest of the test. Otherwise, we keep the same behavior as before.

21 months agoUse old Windows path handling on CI
Eric Holk [Wed, 3 Aug 2022 23:09:06 +0000 (16:09 -0700)]
Use old Windows path handling on CI

21 months agoMove Windows path test function to test code
Eric Holk [Mon, 7 Mar 2022 22:08:29 +0000 (14:08 -0800)]
Move Windows path test function to test code

21 months agoUpdate comment
Eric Holk [Thu, 27 Jan 2022 18:08:40 +0000 (10:08 -0800)]
Update comment

21 months agoUse GetFullPathNameW to test restricted names
Eric Holk [Mon, 24 Jan 2022 19:09:07 +0000 (11:09 -0800)]
Use GetFullPathNameW to test restricted names

The previous commit tests whether the current machine supports Windows
restricted names by creating a file and checking whether that succeeds.
This commit reworks this testto use GetFullPathNameW, which can be done
without having to create and remove new files.

21 months agoTest if reserved filenames are allowed in Windows
Eric Holk [Wed, 19 Jan 2022 19:53:06 +0000 (11:53 -0800)]
Test if reserved filenames are allowed in Windows

Recent versions of Windows have removed the limitation on filenames like
`aux` or `con`. This change allows the `package::reserved_windows_name`
to still pass by first trying to create a file with a reserved name to
see if Windows supports it. If so, it skips the rest of the test.
Otherwise, we keep the same behavior as before.

21 months agoAuto merge of #10924 - akabinds:better-no-such-subcommand, r=epage
bors [Wed, 3 Aug 2022 19:17:49 +0000 (19:17 +0000)]
Auto merge of #10924 - akabinds:better-no-such-subcommand, r=epage

improve error message for `no such subcommand`

Closes #10900

21 months agotest checking full stderr output, with new message, resulting from a "did you mean"
akabinds [Wed, 3 Aug 2022 16:38:41 +0000 (11:38 -0500)]
test checking full stderr output, with new message, resulting from a "did you mean"

21 months agoimplement test checking if stderr, after using `+toolchain`, contains message stating...
akabinds [Wed, 3 Aug 2022 16:07:17 +0000 (11:07 -0500)]
implement test checking if stderr, after using `+toolchain`, contains message stating that the directive is not handled by Cargo

21 months agoMerge branch 'master' of https://github.com/rust-lang/cargo into better-no-such-subco...
akabinds [Wed, 3 Aug 2022 15:53:47 +0000 (10:53 -0500)]
Merge branch 'master' of https://github.com/rust-lang/cargo into better-no-such-subcommand

21 months agoMerge branch 'master' of https://github.com/rust-lang/cargo into better-no-such-subco...
akabinds [Wed, 3 Aug 2022 15:17:56 +0000 (10:17 -0500)]
Merge branch 'master' of https://github.com/rust-lang/cargo into better-no-such-subcommand

21 months agoAuto merge of #10934 - ehuss:revert-jobserver, r=epage
bors [Wed, 3 Aug 2022 15:03:52 +0000 (15:03 +0000)]
Auto merge of #10934 - ehuss:revert-jobserver, r=epage

Revert "Drop check for mingw32-make."

This reverts 8e35e2f044a8a042f9f2eedc35cb6db4649533c9 which seems to be causing a problem on rust-lang/rust Windows CI. I don't have time to investigate why it is failing right now. The Windows CI runs underneath make itself, so there is some recursive make action going on.  However, I can't tell why that would cause failures. Cargo is behaving as-if it is not running underneath make.

I'll try to do some investigation at a later time, for now I'd like to get the update unblocked.

21 months agoRevert "Drop check for mingw32-make."
Eric Huss [Wed, 3 Aug 2022 13:59:35 +0000 (06:59 -0700)]
Revert "Drop check for mingw32-make."

This reverts commit 8e35e2f044a8a042f9f2eedc35cb6db4649533c9.

21 months agoAuto merge of #10929 - ehuss:ignore-reason, r=weihanglo
bors [Wed, 3 Aug 2022 03:54:05 +0000 (03:54 +0000)]
Auto merge of #10929 - ehuss:ignore-reason, r=weihanglo

Add reasons to all ignored tests.

This adds a reason string to all `#[ignore]` attributes. This will be displayed when running the test (since 1.61), which can help quickly see and identify why tests are being ignored. It looks roughly like:

```
test basic ... ignored, requires nightly, CARGO_RUN_BUILD_STD_TESTS must be set
test build::simple_terminal_width ... ignored, --diagnostic-width is stabilized in 1.64
test check_cfg::features_with_cargo_check ... ignored, --check-cfg is unstable
test plugins::panic_abort_plugins ... ignored, requires rustc_private
```

21 months agoMerge branch 'master' into better-no-such-subcommand
binds [Wed, 3 Aug 2022 03:47:20 +0000 (20:47 -0700)]
Merge branch 'master' into better-no-such-subcommand

21 months agoimprove formatting
akabinds [Wed, 3 Aug 2022 03:45:51 +0000 (22:45 -0500)]
improve formatting

21 months agoAuto merge of #10933 - LPardue:cargo-patch-misspell-grammar, r=ehuss
bors [Wed, 3 Aug 2022 02:17:36 +0000 (02:17 +0000)]
Auto merge of #10933 - LPardue:cargo-patch-misspell-grammar, r=ehuss

Grammar fixup unused patch message

This is a minor grammar fixup to to message printed when patch source URLs mismatch (introduced in #10130).

21 months agoGrammar fixup unused patch message
lucas [Wed, 3 Aug 2022 01:22:50 +0000 (02:22 +0100)]
Grammar fixup unused patch message

21 months agostop mixing of newlines and `\n` in tests
akabinds [Wed, 3 Aug 2022 00:43:16 +0000 (19:43 -0500)]
stop mixing of newlines and `\n` in tests

21 months agoMerge branch 'master' into better-no-such-subcommand
binds [Wed, 3 Aug 2022 00:00:57 +0000 (17:00 -0700)]
Merge branch 'master' into better-no-such-subcommand

21 months agofix formatting
akabinds [Tue, 2 Aug 2022 23:27:36 +0000 (18:27 -0500)]
fix formatting

21 months agoimplemented requested changes; tests pass
akabinds [Tue, 2 Aug 2022 23:23:55 +0000 (18:23 -0500)]
implemented requested changes; tests pass

21 months agoAuto merge of #10931 - ehuss:ignore-hg, r=weihanglo
bors [Tue, 2 Aug 2022 22:51:23 +0000 (22:51 +0000)]
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.

21 months agoAlways allow hg to be missing on CI.
Eric Huss [Tue, 2 Aug 2022 22:18:16 +0000 (15:18 -0700)]
Always allow hg to be missing on CI.

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 agoAdd reasons to all ignored tests.
Eric Huss [Tue, 2 Aug 2022 19:12:13 +0000 (12:12 -0700)]
Add reasons to all ignored tests.

21 months agoMerge branch 'better-no-such-subcommand' of https://github.com/akabinds/cargo into...
akabinds [Tue, 2 Aug 2022 18:01:36 +0000 (13:01 -0500)]
Merge branch 'better-no-such-subcommand' of https://github.com/akabinds/cargo into better-no-such-subcommand

21 months agoimplemented requested changes; fixed one failing test (need to fix other)
akabinds [Tue, 2 Aug 2022 18:01:32 +0000 (13:01 -0500)]
implemented requested changes; fixed one failing test (need to fix other)

21 months agoMerge branch 'rust-lang:master' into better-no-such-subcommand
binds [Tue, 2 Aug 2022 15:46:32 +0000 (08:46 -0700)]
Merge branch 'rust-lang:master' into better-no-such-subcommand

21 months agoimprove error message for when subcommand contains `+toolchain`
akabinds [Tue, 2 Aug 2022 15:46:03 +0000 (10:46 -0500)]
improve error message for when subcommand contains `+toolchain`

21 months agoMerge branch 'rust-lang:master' into better-no-such-subcommand
binds [Tue, 2 Aug 2022 14:56:52 +0000 (07:56 -0700)]
Merge branch 'rust-lang:master' into better-no-such-subcommand

21 months agohandling if a subcommand looks like `+toolchain`. very early implementation; very...
akabinds [Tue, 2 Aug 2022 14:56:13 +0000 (09:56 -0500)]
handling if a subcommand looks like `+toolchain`. very early implementation; very basic and not final

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.

22 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).

22 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

22 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.

22 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

22 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.

22 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.

22 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.

22 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.

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

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

22 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.

22 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