Commit graph

12584 commits

Author SHA1 Message Date
hi-rustin f0b5bdad65 Add test for aggressive update
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-08-21 17:14:07 +08:00
bors 1ac83ba696 Auto merge of #11008 - weihanglo:issue-10917, r=epage
Ignore broken but excluded file during traversing
2022-08-21 01:45:41 +00:00
Weihang Lo c0110c6382
Ignore broken but excluded file during traversing
Walkdir's [`filter_entry()`][1] won't call the predicate if the entry
is essentially an `Err` from its underyling `IntoIter`. That means
Cargo hasn't had a chance to call `filter` on an entry that should be
excluded but eventually return an `Err` and cause the loop to stop.
For instance, a broken symlink which should bee excluded by `filter`
will generate an error since `filter` closure is not called with it.

The solution is calling `filter` if an error occurs with a path
(because it has yet been called with that path).
If it's exactly excluded, ignore the error.

[1]: abf3a15887/src/lib.rs (L1042-L1058)
2022-08-20 00:56:43 +01:00
Weihang Lo 52a418c516
test: ignore broken but excluded file during traversing 2022-08-20 00:56:43 +01:00
Weihang Lo 09ff1944ca
Remove unnecessary mutability 2022-08-20 00:56:39 +01:00
bors 6066463e27 Auto merge of #10999 - hi-rustin:rustin-patch-wrong-names, r=epage
Improve error message for wrong target names

### What does this PR try to resolve?

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

We can print all available targets for users.

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

- [x] unit test
2022-08-19 14:35:26 +00:00
hi-rustin 99b3564d0d Update old tests
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-08-19 10:56:29 +08:00
hi-rustin abb463a7aa Improve error message for wrong target names 2022-08-19 10:53:09 +08:00
bors 0c57749ca3 Auto merge of #11005 - jonhoo:bump-snapbox, r=epage
Bump snapbox to 0.3

0.3 has a small number of [breaking changes], but makes diffs much
easier to visually parse by eliding large sections of unchanged content.

[breaking changes]: https://github.com/assert-rs/trycmd/blob/main/crates/snapbox/CHANGELOG.md#030---2022-08-01

r? `@epage`
2022-08-18 01:16:09 +00:00
Jon Gjengset ed78e6b747 Bump snapbox to 0.3
0.3 has a small number of [breaking changes], but makes diffs much
easier to visually parse by eliding large sections of unchanged content.

[breaking changes]: https://github.com/assert-rs/trycmd/blob/main/crates/snapbox/CHANGELOG.md#030---2022-08-01
2022-08-17 22:07:20 +00:00
bors 3b4df5a54a Auto merge of #11001 - Muscraft:fix-unstable-docs, r=weihanglo
remove missed reference to workspace inheritance in unstable.md

Currently on the nightly docs, workspace inheritance is [under the  stable table](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#workspace-inheritance-1)  and the [unstable table](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#workspace-inheritance). It looks like I forgot to remove it from the unstable table when working on stabilization.

I am not sure if it is worth a beta backport but I will happily open a PR for it if needed.
2022-08-17 20:18:30 +00:00
Scott Schafer a5a98f6c7c remove missed reference to workspace inheritance in unstable.md 2022-08-17 14:15:50 -05:00
bors 9e1b4577ce Auto merge of #10988 - hi-rustin:rustin-patch-warn, r=epage
Warning when precise or aggressive without -p flag

### What does this PR try to resolve?

ref https://github.com/rust-lang/cargo/issues/10919.

Warning when precise or aggressive without -p flag. It will be a hard error in future.

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

- Unit test.
2022-08-17 14:36:56 +00:00
hi-rustin a58489dfbb Add test for aggressive update
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-08-17 21:53:12 +08:00
hi-rustin f95deaafeb Warning when precise or aggressive without -p flag
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-08-17 21:53:07 +08:00
bors 9809f8ff33 Auto merge of #10944 - kcrimson-ar:master, r=epage
Improve error message for an array value in the manifest

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

The error message will be:

```
error: failed to parse manifest at `/Users/..`

Caused by:
  invalid type: string "Ky", expected an array for key `package.authors`
```
2022-08-16 22:10:06 +00:00
bors 5a7ba9cdfb Auto merge of #10975 - theCapypara:flock-enosys-android, r=weihanglo
Fix file locking being not supported on Android raising an error

This PR fixes #10972 by not failing Cargo operations when the `target_os` is Android and file locking is being reported as not being implemented by the kernel.

I am sadly unable to actually test this at the moment, since despite my best efforts I am not able to get Cargo actually cross-compiled for Android (aarch64-linux-android).

I however don't see any reason why this wouldn't work. `target_os` is "android" on Android and not "linux".
2022-08-16 12:29:32 +00:00
Marco Köpcke b0c9586f4c No longer gate unsupported file locking behind Linux as OS 2022-08-16 12:46:47 +02:00
bors 84941490fd Auto merge of #10983 - ehuss:version-bump, r=weihanglo
Bump to 0.66.0, update changelog
2022-08-12 21:14:11 +00:00
Eric Huss aae4c84a09 Also mention build.target being an array. 2022-08-12 14:12:22 -07:00
Eric Huss b1f49c9737 Update changelog for 1.64 2022-08-12 13:22:37 -07:00
Eric Huss 34632c5925 Bump to 0.66.0 2022-08-12 12:22:05 -07:00
bors efd4ca3dc0 Auto merge of #10977 - weihanglo:std-thread-scope, r=epage
Use `std:🧵:scope` to replace crossbeam

Drop one dependency as `std:🧵:Scope` got stabilized in 1.63.

Haven't done any benchmark. (Should we?)
2022-08-12 01:28:28 +00:00
bors 4fe9b13276 Auto merge of #10978 - andrewpollack:docs-removing-excess-in, r=weihanglo
[docs] Remove extra "in" from `cargo-test.md`

Removes an extra "in" from doc src/doc/src/commands/cargo-test.md

Successor to #10971 without bungled merge
2022-08-11 23:57:19 +00:00
andrewpollack 195b1e0e50 Removing excess in 2022-08-11 16:47:52 -07:00
Weihang Lo 33497512a8
Use std:🧵:scope to replace crossbeam 2022-08-12 00:09:54 +01:00
bors 34cba461f2 Auto merge of #10930 - ehuss:enable-windows-tests, r=weihanglo
Enable two windows tests

These two tests were disabled on Windows a long time ago. AFAICT, the reasons are no longer relevant, and it should be safe to enable these tests. See each commit for a more detailed exposition.
2022-08-11 22:30:26 +00:00
Marco Capypara Köpcke 585cf31990 Fix flock being not supported on Android raising an error 2022-08-11 15:47:09 +02: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
Ky Phan 8f1a75d584 Add unit test for invalid authors, refactor name 2022-08-08 22:05:43 +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
Ky Phan ee1d688da4 Improve error message for an array 2022-08-06 13:52:39 +07: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