Commit graph

12553 commits

Author SHA1 Message Date
Weihang Lo
33497512a8
Use std:🧵:scope to replace crossbeam 2022-08-12 00:09:54 +01:00
bors
1ac43cf649 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`.
2022-08-11 03:23:09 +00:00
bors
a120cfe08e 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.
2022-08-10 21:55:46 +00:00
bors
3a17953664 Auto merge of #10969 - joshtriplett:available-parallelism, r=epage
Switch back to `available_parallelism`

This reverts commit 8345cf5037 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.
2022-08-10 17:52:21 +00:00
Josh Triplett
86163845a5 Switch back to available_parallelism
This reverts commit 8345cf5037. 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.
2022-08-10 17:49:24 +02:00
Wim Looman
61c4b11eae
Ensure rustc-echo-wrapper works with an overridden build.target-dir 2022-08-10 17:37:40 +02:00
hi-rustin
6bb4050552 Fix test
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-08-10 23:19:35 +08:00
hi-rustin
f11d9a1852 Improve error msg for get target runner
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-08-10 22:43:00 +08:00
bors
1fcbca84ee 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)
2022-08-10 14:30:11 +00:00
bors
fcf3281ec7 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
2022-08-10 13:47:46 +00:00
hi-rustin
ccf81aee3a Add CARGO_LOG to Environment variables Cargo reads
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-08-10 20:51:28 +08:00
Wim Looman
492358a19f
Only override published resolver when the workspace is different 2022-08-10 09:26:50 +02:00
bors
ce40690a5e 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.
2022-08-09 22:32:17 +00:00
Wim Looman
df0c64ebc1
Have Edition know what its default resolver behaviour is 2022-08-09 22:07:12 +02:00
Josh Triplett
934e79072a 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.
2022-08-08 10:37:15 -07:00
Josh Triplett
dcbb433340 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.
2022-08-08 10:37:15 -07:00
bors
e6827eee9b 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.
2022-08-06 22:45:31 +00:00
Ralf Jung
99f279bb9d resolver docs: link to version requirements syntax full explanation 2022-08-06 17:01:59 -04:00
bors
0ced33b165 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
2022-08-06 15:14:30 +00:00
hi-rustin
df8f33b4f2 Bump os_info to 3.5.0
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-08-06 13:12:20 +08:00
bors
40d71af13a 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.
2022-08-05 23:46:48 +00:00
hi-rustin
a6e6b89d71 Mark -timings=html unstable in the document
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-08-05 19:39:13 +08:00
bors
5ac9be2eea 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
2022-08-04 13:59:45 +00:00
har7an
e8cd6f4bcf 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.
2022-08-04 09:20:40 +02:00
bors
7259757dc6 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.
2022-08-04 00:32:49 +00:00
Eric Holk
8de9adfb0d Use old Windows path handling on CI 2022-08-03 16:09:06 -07:00
Eric Holk
e9c7544c19 Move Windows path test function to test code 2022-08-03 15:59:59 -07:00
Eric Holk
d03530f261 Update comment 2022-08-03 15:59:58 -07:00
Eric Holk
f122dbbd41 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.
2022-08-03 15:59:58 -07:00
Eric Holk
0adcc183bc 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.
2022-08-03 15:59:58 -07:00
bors
471b80df64 Auto merge of #10924 - akabinds:better-no-such-subcommand, r=epage
improve error message for `no such subcommand`

Closes #10900
2022-08-03 19:17:49 +00:00
akabinds
222d90b78e test checking full stderr output, with new message, resulting from a "did you mean" 2022-08-03 11:38:41 -05:00
akabinds
8f5f2ed2a2 implement test checking if stderr, after using +toolchain, contains message stating that the directive is not handled by Cargo 2022-08-03 11:07:17 -05:00
akabinds
13776d2c59 Merge branch 'master' of https://github.com/rust-lang/cargo into better-no-such-subcommand 2022-08-03 10:53:47 -05:00
akabinds
b1829b8dbd Merge branch 'master' of https://github.com/rust-lang/cargo into better-no-such-subcommand 2022-08-03 10:17:56 -05:00
bors
4fd148c47e Auto merge of #10934 - ehuss:revert-jobserver, r=epage
Revert "Drop check for mingw32-make."

This reverts 8e35e2f044 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.
2022-08-03 15:03:52 +00:00
Eric Huss
8bf7b8b89b Revert "Drop check for mingw32-make."
This reverts commit 8e35e2f044.
2022-08-03 06:59:35 -07:00
bors
333478d0aa 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
```
2022-08-03 03:54:05 +00:00
binds
adf5441b7a
Merge branch 'master' into better-no-such-subcommand 2022-08-02 20:47:20 -07:00
akabinds
91bc002f52 improve formatting 2022-08-02 22:45:51 -05:00
bors
9803862d16 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).
2022-08-03 02:17:36 +00:00
lucas
02e606d799 Grammar fixup unused patch message 2022-08-03 02:22:50 +01:00
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
Eric Huss
7eb007ddbf Add reasons to all ignored tests. 2022-08-02 12:24:00 -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