Support abbreviating `--release` as `-r`
Of the options people regularly pass to cargo, `--release` seems by far
the most common. Yet even on the command line, we expect people to type
out `--release`.
Add a short version `-r`, and add some tests in the testsuite that
confirm it works.
Fix some tests with output collisions.
This fixes some tests which run afoul of creating colliding outputs (tracked in #6313). In particular, these tests are creating duplicate pdb files on Windows because they have a binary and a library (dylib) with the same name. This is causing significant issues on rust-lang's CI (https://github.com/rust-lang/rust/issues/81890) where the MSVC linker is failing with a mysterious LNK1201 error. Presumably two LINK.exe processes are trying to write to the same PDB file at the same time, which causes it to fail.
Ideally this shouldn't happen, but I don't really have any ideas on how to resolve it, as the name of the PDB has some importance.
I have not been able to reproduce the LNK1201 error. My hope is that this change will help alleviate the issue, though.
I updated the `doc_all_member_dependency_same_name` test to illustrate that it is hitting a collision, which is a fundamental part of that test (and something we should probably figure out how to resolve in the future).
Improve unused patch message when source URLs mismatched
Resolves#8690
`Resolve.unused_patches` does not contains info about which source
URLs they are going to patch. As a result, we cannot provide a precise
message but only list all possible URLs of the packages with the same
name in the resolved graph.
There is a little flaw that if multiple patches are patching the same
package, the source URL of the used one would be shown as a possible
URL in the warning.
Of the options people regularly pass to cargo, `--release` seems by far
the most common. Yet even on the command line, we expect people to type
out `--release`.
Add a short version `-r`, and add some tests in the testsuite that
confirm it works.
`Resolve.unused_patches` does not contains info about which source
URLs they are going to patch. As a result, we cannot provide a precise
message but only list all possible URLs of the packages with the same
name in the resolved graph.
There is a little flaw that if multiple patches are patching the same
package, the source URL of the used one would be shown as a possible
URL in the warning.
Fix a couple issues with cyclic features and dev-dependencies
This fixes two issues with cyclic features and dev-dependencies:
* `cargo tree` would enter an infinite loop for cyclic features.
* The resolver would return a confusing error if a cyclic dev-dependency attempted to enable a feature on its parent that resulted in a cycle. This fixes it to resolve correctly.
Fixes#10101
Give a hard error if `-Zrustdoc-scrape-examples` is missing a flag
It's the same as if the option wasn't passed, and it makes it difficult to
figure out why rustdoc isn't generating examples.
Fixes https://github.com/rust-lang/cargo/issues/10042 (cc `@willcrichton)`
There is a convoluted situation where a cyclic dev-dependency attempts
to enable a feature on its parent. It would result in a confusing error
saying a package didn't have a feature.
This check was intended only for CLI features, not features passed
through the dependency graph.
Warn when alias shadows external subcommand
As per #10049, we start by emitting a warning when an alias shadows an
existing external subcommand. After a transition period (duration not
specified), we will make this a hard error.
Should the warning mention that this will become a hard error?
Implement escaping to allow clean -p to delete all files when directory contains glob characters
Closes#10068.
Runs `glob::Pattern::escape` on path input to `rm_rf_glob()`. This fixes a bug in which `cargo clean -p` fails to delete a number of files from `target/` if the path to target contains glob characters.
Match any error when failing to find executables
For Windows targets, Rust now uses [a custom resolver](https://github.com/rust-lang/rust/pull/87704) to find `process::Command` programs. This has caused some error messages to change.
To allow the PR to be merged, some tests have been adjusted to match any error.
cc `@ehuss`
For Windows targets, Rust now uses a custom resolver to find `process::Command` programs. This has caused some error messages to change.
To allow it to be merged, some tests have been adjusted to match any error.
Implement glob escaping for clean -p
Add pattern escape for glob matching cargo clean files
Implement correct solution for #10068
Removed superfluous formatting changes
Update rm_rf_glob()'s error handling
Remove dir_glob reference for non-glob function
Added test
Satisfy clippy
Add MSVC support for test
Change --scrape-examples flag to -Z rustdoc-scrape-examples
I'm working on getting the scrape examples feature working on docs.rs. However, docs.rs uses `cargo rustdoc` instead of `cargo doc`, and right now the `--scrape-examples` flag is only allowed for `cargo doc`. So this PR changes it to a `-Z` flag that can be passed to either command.
* Docscrape unit not having dev-dependencies included
* Sources for reverse-dependencies generated to the wrong directory
* Incorrect features being selected for Docscrape units
* Panics from Docscrape-dependent packages not being available
Make future-incompat-report output more user-friendly
When the user enables `--future-incompat-report`, we now display
a high-level summary of the problem, as well as several suggestions
for fixing the affected crates.
The command `cargo report future-incompatibilities` now takes
a `--crate` option, which can be used to display a report
(including the actual lint messages) for a single crate.
When this option is not used, we display the report for all
crates.
Sample output from the `actix` crate:
`> RUSTFLAGS="-Z future-incompat-test" ~/repos/cargo/target/debug/cargo build -Z future-incompat-report
`
```
Finished dev [unoptimized + debuginfo] target(s) in 2.09s
warning: the following packages contain code that will be rejected by a future version of Rust: actix v0.11.1 (/home/aaron/repos/actix/actix), ahash v0.7.4, arc-swap v0.4.4, autocfg v1.0.0, crossbeam-utils v0.8.5, futures-macro v0.3.17, futures-util v0.3.17, lazy_static v1.4.0, libc v0.2.103, lock_api v0.4.5, log v0.4.8, mio v0.7.13, parking_lot_core v0.8.5, signal-hook-registry v1.2.0, smallvec v1.7.0, syn v1.0.77, tokio v1.12.0, tokio-util v0.6.8, unicode-xid v0.2.0, version_check v0.9.3
note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 2`
```
`> RUSTFLAGS="-Z future-incompat-test" ~/repos/cargo/target/debug/cargo build -Z future-incompat-report --future-incompat-report -Z unstable-options`
```
Finished dev [unoptimized + debuginfo] target(s) in 2.12s
warning: the following packages contain code that will be rejected by a future version of Rust: actix v0.11.1 (/home/aaron/repos/actix/actix), ahash v0.7.4, arc-swap v0.4.4, autocfg v1.0.0, crossbeam-utils v0.8.5, futures-macro v0.3.17, futures-util v0.3.17, lazy_static v1.4.0, libc v0.2.103, lock_api v0.4.5, log v0.4.8, mio v0.7.13, parking_lot_core v0.8.5, signal-hook-registry v1.2.0, smallvec v1.7.0, syn v1.0.77, tokio v1.12.0, tokio-util v0.6.8, unicode-xid v0.2.0, version_check v0.9.3
note:
To solve this problem, you can try the following approaches:
- Some affected dependencies have newer versions available.
You may want to consider updating them to a newer version to see if the issue has been fixed.
ahash v0.7.4 has the following newer versions available: 0.7.5
arc-swap v0.4.4 has the following newer versions available: 0.4.8, 1.1.0, 1.2.0, 1.3.0, 1.3.1, 1.3.2, 1.4.0
autocfg v1.0.0 has the following newer versions available: 1.0.1
log v0.4.8 has the following newer versions available: 0.4.11, 0.4.13, 0.4.14
signal-hook-registry v1.2.0 has the following newer versions available: 1.2.1, 1.2.2, 1.3.0, 1.4.0
syn v1.0.77 has the following newer versions available: 1.0.78, 1.0.79, 1.0.80
unicode-xid v0.2.0 has the following newer versions available: 0.2.1, 0.2.2
- If the issue is not solved by updating the dependencies, a fix has to be
implemented by those dependencies. You can help with that by notifying the
maintainers of this problem (e.g. by creating a bug report) or by proposing a
fix to the maintainers (e.g. by creating a pull request):
- actix:0.11.1
- Repository: https://github.com/actix/actix
- Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "actix:0.11.1"
- ahash:0.7.4
- Repository: https://github.com/tkaitchuck/ahash
- Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "ahash:0.7.4"
- arc-swap:0.4.4
- Repository: https://github.com/vorner/arc-swap
- Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "arc-swap:0.4.4"
- autocfg:1.0.0
- Repository: https://github.com/cuviper/autocfg
- Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "autocfg:1.0.0"
- crossbeam-utils:0.8.5
- Repository: https://github.com/crossbeam-rs/crossbeam
- Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "crossbeam-utils:0.8.5"
- futures-macro:0.3.17
- Repository: https://github.com/rust-lang/futures-rs
- Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "futures-macro:0.3.17"
- futures-util:0.3.17
- Repository: https://github.com/rust-lang/futures-rs
- Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "futures-util:0.3.17"
- lazy_static:1.4.0
- Repository: https://github.com/rust-lang-nursery/lazy-static.rs
- Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "lazy_static:1.4.0"
- libc:0.2.103
- Repository: https://github.com/rust-lang/libc
- Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "libc:0.2.103"
- lock_api:0.4.5
- Repository: https://github.com/Amanieu/parking_lot
- Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "lock_api:0.4.5"
- log:0.4.8
- Repository: https://github.com/rust-lang/log
- Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "log:0.4.8"
- mio:0.7.13
- Repository: https://github.com/tokio-rs/mio
- Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "mio:0.7.13"
- parking_lot_core:0.8.5
- Repository: https://github.com/Amanieu/parking_lot
- Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "parking_lot_core:0.8.5"
- signal-hook-registry:1.2.0
- Repository: https://github.com/vorner/signal-hook
- Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "signal-hook-registry:1.2.0"
- smallvec:1.7.0
- Repository: https://github.com/servo/rust-smallvec
- Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "smallvec:1.7.0"
- syn:1.0.77
- Repository: https://github.com/dtolnay/syn
- Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "syn:1.0.77"
- tokio:1.12.0
- Repository: https://github.com/tokio-rs/tokio
- Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "tokio:1.12.0"
- tokio-util:0.6.8
- Repository: https://github.com/tokio-rs/tokio
- Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "tokio-util:0.6.8"
- unicode-xid:0.2.0
- Repository: https://github.com/unicode-rs/unicode-xid
- Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "unicode-xid:0.2.0"
- version_check:0.9.3
- Repository: https://github.com/SergioBenitez/version_check
- Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "version_check:0.9.3"
- If waiting for an upstream fix is not an option, you can use the `[patch]`
section in `Cargo.toml` to use your own version of the dependency. For more
information, see:
https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section
note: this report can be shown with `cargo report future-incompatibilities -Z future-incompat-report --id 3`
```
`> RUSTFLAGS="-Z future-incompat-test" ~/repos/cargo/target/debug/cargo report future-incompatibilities -Z future-incompat-report --color never | head -n 100`
```
The following warnings were discovered during the build. These warnings are an
indication that the packages contain code that will become an error in a
future release of Rust. These warnings typically cover changes to close
soundness problems, unintended or undocumented behavior, or critical problems
that cannot be fixed in a backwards-compatible fashion, and are not expected
to be in wide use.
Each warning should contain a link for more information on what the warning
means and how to resolve it.
- Some affected dependencies have newer versions available.
You may want to consider updating them to a newer version to see if the issue has been fixed.
ahash v0.7.4 has the following newer versions available: 0.7.5
arc-swap v0.4.4 has the following newer versions available: 0.4.8, 1.1.0, 1.2.0, 1.3.0, 1.3.1, 1.3.2, 1.4.0
autocfg v1.0.0 has the following newer versions available: 1.0.1
log v0.4.8 has the following newer versions available: 0.4.11, 0.4.13, 0.4.14
signal-hook-registry v1.2.0 has the following newer versions available: 1.2.1, 1.2.2, 1.3.0, 1.4.0
syn v1.0.77 has the following newer versions available: 1.0.78, 1.0.79, 1.0.80
unicode-xid v0.2.0 has the following newer versions available: 0.2.1, 0.2.2
The package `actix v0.11.1 (/home/aaron/repos/actix/actix)` currently triggers the following future incompatibility lints:
> warning: use of deprecated struct `utils::Condition`: Please use tokio::sync::oneshot::Sender instead.
> --> actix/src/utils.rs:25:9
> |
> 25 | impl<T> Condition<T>
> | ^^^^^^^^^
> |
> note: the lint level is defined here
> --> actix/src/lib.rs:30:10
> |
> 30 | #![allow(deprecated)]
> | ^^^^^^^^^^
>
> warning: use of deprecated struct `utils::Condition`: Please use tokio::sync::oneshot::Sender instead.
> --> actix/src/utils.rs:42:21
> |
> 42 | impl<T> Default for Condition<T>
> | ^^^^^^^^^
>
> warning: use of deprecated struct `utils::Condition`: Please use tokio::sync::oneshot::Sender instead.
> --> actix/src/utils.rs:47:9
> |
> 47 | Condition {
> | ^^^^^^^^^
>
> warning: use of deprecated struct `utils::Condition`: Please use tokio::sync::oneshot::Sender instead.
> --> actix/src/lib.rs:120:28
> |
> 120 | pub use crate::utils::{Condition, IntervalFunc, TimerFunc};
> | ^^^^^^^^^
>
> warning: use of deprecated associated function `std::sync::atomic::AtomicUsize::compare_and_swap`: Use `compare_exchange` or `compare_exchange_weak` instead
> --> actix/src/address/channel.rs:512:49
> |
> 512 | let actual = self.inner.num_senders.compare_and_swap(curr, next, SeqCst);
> | ^^^^^^^^^^^^^^^^
>
> warning: use of deprecated associated function `std::sync::atomic::AtomicUsize::compare_and_swap`: Use `compare_exchange` or `compare_exchange_weak` instead
> --> actix/src/address/channel.rs:636:49
> |
> 636 | let actual = self.inner.num_senders.compare_and_swap(curr, next, SeqCst);
> | ^^^^^^^^^^^^^^^^
>
> warning: use of deprecated associated function `std::sync::atomic::AtomicUsize::compare_and_swap`: Use `compare_exchange` or `compare_exchange_weak` instead
> --> actix/src/address/channel.rs:697:49
> |
> 697 | let actual = self.inner.num_senders.compare_and_swap(curr, next, SeqCst);
> | ^^^^^^^^^^^^^^^^
>
> warning: use of deprecated field `utils::Condition::waiters`: Please use tokio::sync::oneshot::Sender instead.
> --> actix/src/utils.rs:31:9
> |
> 31 | self.waiters.push(tx);
> | ^^^^^^^^^^^^
>
> warning: use of deprecated field `utils::Condition::waiters`: Please use tokio::sync::oneshot::Sender instead.
> --> actix/src/utils.rs:36:23
> |
> 36 | for waiter in self.waiters {
> | ^^^^^^^^^^^^
>
> warning: use of deprecated field `utils::Condition::waiters`: Please use tokio::sync::oneshot::Sender instead.
> --> actix/src/utils.rs:48:13
> |
> 48 | waiters: Vec::new(),
> | ^^^^^^^^^^^^^^^^^^^
>
> warning: unused variable: `ctx`
> --> actix/src/actor.rs:78:27
> |
> 78 | fn started(&mut self, ctx: &mut Self::Context) {}
> | ^^^ help: if this is intentional, prefix it with an underscore: `_ctx`
> |
> note: the lint level is defined here
> --> actix/src/actor.rs:72:9
> |
> 72 | #[allow(unused_variables)]
> | ^^^^^^^^^^^^^^^^
```