Commit graph

11776 commits

Author SHA1 Message Date
Weihang Lo
2f5b3033f2
Update doc for CompileFilter 2022-01-20 13:02:17 +08:00
Weihang Lo
ecbaec1a9f
Use new_all_targets in cargo-fix when no target selection exists 2022-01-20 13:02:17 +08:00
Weihang Lo
0a73f8b9fd
Extract logic of single bin target filter to single_bin 2022-01-20 13:02:17 +08:00
Weihang Lo
5aa985c42a
Extract logic of lib target only filter to lib_only 2022-01-20 13:02:05 +08:00
Weihang Lo
9138c35d8c
Extract logic of all test target filter to all_test_targets 2022-01-20 13:01:54 +08:00
Weihang Lo
bee3534f27
test: do not compile test for bins flagged as test = false 2022-01-19 03:36:53 +08:00
Weihang Lo
0a7a7bd5ef
do not compile test for bins flagged as test = false
Binaries without `test = false` are included by default, so no need to
explicitly compile all binaries.
2022-01-19 03:35:35 +08:00
Weihang Lo
f07dcd13a0
test: compile all bins when TESTNAME arg exists
This behavior is not correct should be fixed.
Update this test only for pointing out the current behavior.
2022-01-19 02:47:30 +08:00
bors
e778b3d90a Auto merge of #10298 - hi-rustin:rustin-patch-triagebot, r=ehuss
Enable shortcut for triage bot

### What does this PR try to resolve?

Enable shortcut for triage bot. See: https://github.com/rust-lang/cargo/pull/10167#issuecomment-1013815453
### How should we test and review this PR?

We need to test it after the merge. But there should be no problem with the robot. I refer to the rust configuration file.

### Additional information

I don't know if it is accepted to open it, if we don't want to open it please feel free to close my PR.
2022-01-16 17:02:31 +00:00
hi-rustin
22bcd7a7ed Enable shortcut for triage bot
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-01-16 13:52:52 +08:00
bors
6d19e80192 Auto merge of #10294 - ehuss:version-bump, r=Eh2406
Bump to 0.61.0, update changelog
2022-01-15 16:42:51 +00:00
Eric Huss
171f67d6a9 Update changelog for 1.59 2022-01-14 13:38:39 -08:00
Eric Huss
a25d3864d9 Bump to 0.61.0 2022-01-14 10:57:54 -08:00
bors
203f36ed61 Auto merge of #10291 - calebcartwright:cargo-fmt-check, r=ehuss
use new cargo fmt option

As of v1.58, cargo fmt now supports the --check flag directly. Updating it here (and in a few other r-l repos) both because it's more succinct and so more people will see/become aware
2022-01-14 00:21:19 +00:00
Caleb Cartwright
98edf2854b
ci: use new cargo fmt option 2022-01-13 17:57:25 -06:00
bors
d43a5073e8 Auto merge of #10287 - Nilstrieb:docs-semver-check-run-fail, r=ehuss
Add `run-fail` to semver-check for docs

I encountered this missing feature in #10276 and therefore added it here in this separate PR.

If the breaking change does not involve a compilation error but a change in runtime behaviour, you can add `run-fail` to the codeblock. The "before" code must return exit code 0, and the "after" code must be nonzero (like a panic).

Example case that I tested (ignore the trailing dot, it's for github markdown to not hate me)

```
```rust,ignore,run-fail
// MAJOR CHANGE

///////////////////////////////////////////////////////////
// Before
pub fn foo() {}
///////////////////////////////////////////////////////////
// After
pub fn foo() {
    panic!("hey!");
}
///////////////////////////////////////////////////////////
// Example usage that will break.
fn main() {
    updated_crate::foo();
}
```.
```
2022-01-13 23:38:53 +00:00
bors
c6745a3d7f Auto merge of #10290 - maxwase:is_symlink_stabilized, r=Eh2406
Use `is_symlink()` method

I've came across this comment
```rust
// Replace with std implementation when stabilized, see
// https://github.com/rust-lang/rust/issues/85748
```
and fixed this due to the method stabilization in 1.58
2022-01-13 22:42:26 +00:00
maxwase
2623af0c43 Use is_symlink() method 2022-01-14 00:36:24 +03:00
Nilstrieb
6865218f15 docs: add run-fail to semver check
if the breaking change does not involve a compilation error but a change in runtime behaviour, you can add `run-fail` to the codeblock. The "before" code must return exit code 0, and the "after" code must be nonzero (like a panic).
2022-01-12 20:43:14 +01:00
bors
e77c0719fd Auto merge of #10269 - ehuss:stabilized-new-features, r=alexcrichton
Stabilize namespaced and weak dependency features.

This stabilizes the namespaced and weak dependency features.  Support is now enabled on crates.io, so this should be ready to go.

As a part of this change, the new feature resolver is now enabled all of the time. This is fairly risky, since there are likely edge cases that haven't been exercised.
NOTE: Projects using `resolver="1"` *should* continue to have the same behavior, the old resolver behavior is emulated.

Closes #8813
Closes #8832
2022-01-12 15:15:09 +00:00
bors
06b9d31743 Auto merge of #10265 - epage:clap-port, r=joshtriplett
Port cargo to clap3

### What does this PR try to resolve?

This moves cargo to the latest major version of clap.

This supersedes #10259  and #10262

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

For testing, I mostly relied on existing tests.  I did manually validate that `cargo run <non-escaped command args>` behaved the same between both
```console
$ cargo run release --help
    Finished dev [unoptimized + debuginfo] target(s) in 0.22s
     Running `target/debug/cargo-release release --help`
cargo-release 0.18.8
...

$ cargo run --manifest-path ../cargo/Cargo.toml -- run release --help
    Finished dev [unoptimized + debuginfo] target(s) in 0.05s
     Running `/home/epage/src/personal/cargo/target/debug/cargo run release --help`
    Finished dev [unoptimized + debuginfo] target(s) in 1.31s
     Running `target/debug/cargo-release release --help`
cargo-release 0.18.8
...
```

For reviewing, I split out each deprecation resolution into a separate commit so its easy to focus on more mechanical changes (most of the deprecation fixes) from interesting ones (the port, the `Arg::multiple` deprecation)

### Additional information

- One parser change found by `cargo_config::includes` is that clap 2
  would ignore any values after a `=` for flags.
  `cargo config --show-origin` is a flag but the test passed `--show-origin=yes` which
  happens to give the desired result for that test but is the same as
  `--show-origin=no` or `--show-origin=alien-invasion`.
- `ArgMatches` now panics when accessing an undefined argument but clap
  takes advantage of that for sharing code across commands that have
  different subsets of arguments defined.  I've extended clap so we can
  "look before you leap" and put the checks at the argument calls to
  start off with so its very clear what is tenuously shared.  This
  allows us to go in either direction in the future, either addressing
  how we are sharing between commands or by moving this down into the
  extension methods and pretending this clap feature doesn't exist
- On that topic, a test found clap-rs/clap#3263.  For now, there is a
  hack in clap.  Depending on how we fix that in clap for clap 4.0, we
  might need to re-address things in cargo.
- `value_of_os` now requires setting `allow_invalid_utf8`, otherwise it
  asserts.  To help catch this, I updated the argument definitions
  associated with lookups reported by:
  - `rg 'values?_os' src/`
  - `rg 'values?_of_os' src/`
- clap now reports `2` for usage errors, so we had to bypass clap's
  `exit` call to keep the same exit code.
- `cargo vendor --sync` did not use `multi_opt` and so it has both
  multiple occurrences **and** multiple values.  If we want to deprecate
  this, we'll need `unstable-grouped` to be stablized (or pin our clap
  version) and ensure each group has only 1 value.
2022-01-11 23:47:29 +00:00
bors
0655dd25a0 Auto merge of #10217 - zhamlin:feat/profile-rustflags, r=ehuss
feat: support rustflags per profile

Fix for issue https://github.com/rust-lang/cargo/issues/7878
2022-01-10 16:56:16 +00:00
Zach Hamlin
68fd67319d feat: support rustflags per profile 2022-01-09 11:35:15 -06:00
Eric Huss
43a063c80a Stabilize namespaced and weak dependency features. 2022-01-06 15:56:56 -08:00
bors
aee9262070 Auto merge of #10267 - joshtriplett:pr-template-bors-comments, r=alexcrichton
Make bors ignore the PR template so it doesn't end up in merge messages
2022-01-06 21:52:20 +00:00
Josh Triplett
c1a5a4c6b2 Make bors ignore the PR template so it doesn't end up in merge messages 2022-01-06 12:24:12 -08:00
Ed Page
92fa72d480 refactor: Resolve Arg::multiple deprecation
Note: `cargo vendor --sync` did not use `multi_opt` and so it has both
multiple occurrences **and** multiple values.  If we want to deprecate
this, we'll need `unstable-grouped` to be stablized (or pin our clap
version) and ensure each group has only 1 value.
2022-01-06 09:18:14 -06:00
Ed Page
6e08a30e26 refactor: Resolve SubCommand::with_new deprecation 2022-01-06 09:14:12 -06:00
Ed Page
24f301b3e1 refactor: Resolve App::settings deprecation 2022-01-06 09:14:08 -06:00
Ed Page
0ab4d0cbfa refactor: Resolve App::help deprecation 2022-01-06 09:14:02 -06:00
Ed Page
5cd062e4dc refactor: Resolve App::template deprecation 2022-01-06 09:13:58 -06:00
Ed Page
aed031253a refactor: Resolve App::usage deprecation 2022-01-06 09:13:54 -06:00
Ed Page
f9b28cfbba refactor: Resolve App::get_matches_safe deprecation 2022-01-06 09:13:51 -06:00
Ed Page
2aa4e9fbad refactor: Resolve AppSettings::UnifiedHelpMessage deprecation 2022-01-06 09:13:47 -06:00
Ed Page
f3ec865fe4 refactor: Resolve Arg::empty_values deprecation 2022-01-06 09:13:42 -06:00
Ed Page
5435b269e4 refactor: Resolve Arg::hidden deprecation 2022-01-06 09:13:38 -06:00
Ed Page
88a122c428 refactor: Resolve Arg::with_name deprecation 2022-01-06 09:13:34 -06:00
Ed Page
f17ecafc24 Upgrade to Clap 3
- One parser change found by `cargo_config::includes` is that clap 2
  would ignore any values after a `=` for flags.
  `cargo config --show-origin` is a flag but the test passed `--show-origin=yes` which
  happens to give the desired result for that test but is the same as
  `--show-origin=no` or `--show-origin=alien-invasion`.
- The parser now panics when accessing an undefined attribute but clap
  takes advantage of that for sharing code across commands that have
  different subsets of arguments defined.  I've extended clap so we can
  "look before you leap" and put the checks at the argument calls to
  start off with so its very clear what is tenuously shared.  This
  allows us to go in either direction in the future, either addressing
  how we are sharing between commands or by moving this down into the
  extension methods and pretending this clap feature doesn't exist
- On that topic, a test found clap-rs/clap#3263.  For now, there is a
  hack in clap.  Depending on how we fix that in clap for clap 4.0, we
  might need to re-address things in cargo.
- `value_of_os` now requires setting `allow_invalid_utf8`, otherwise it
  asserts.  To help catch this, I updated the argument definitions
  associated with lookups reported by:
  - `rg 'values?_os' src/`
  - `rg 'values?_of_os' src/`
- clap now reports `2` for usage errors, so we had to bypass clap's
  `exit` call to keep the same exit code.

BREAKING CHANGE: API now uses clap3
2022-01-05 19:54:54 -06:00
bors
2478331215 Auto merge of #10214 - weihanglo:revert-10188-issue-9528, r=alexcrichton
Be resilient to most IO error and filesystem loop while walking dirs

Let `PathSource::walk` be resilient to most IO errors and filesystem loop.

This PR also

- Add a test validating the resilience against filesystem loop to prevent regression.
- Emit warning when filesystem loop found while walking the filesystem. This is the only way I can think of now to solve #9528

Fixes #10213.
2022-01-05 22:10:29 +00:00
bors
dc6d847830 Auto merge of #10258 - joshtriplett:unconditional-pipelining, r=alexcrichton
Remove the option to disable pipelining

Cargo has had pipelining enabled by default for a long time, without
issue. Remove support for `build.pipelining = false`. (Continue parsing
the option from the config file, but ignore it.)

<!--
Thanks for submitting a pull request 🎉! Here are some tips for you:

* If this is your first contribution, read "Cargo Contribution Guide":
  https://doc.crates.io/contrib/
* Run `cargo fmt --all` to format your code changes.
* Small commits and pull requests are always preferable and easy to review.
* If your idea is large and needs feedback from the community, read how:
  https://doc.crates.io/contrib/process/#working-on-large-features
* Cargo takes care of compatibility. Read our design principles:
  https://doc.crates.io/contrib/design.html
* When changing help text of cargo commands, follow the steps to generate docs:
  https://github.com/rust-lang/cargo/tree/master/src/doc#building-the-man-pages
* If your PR is not finished, set it as "draft" PR or add "WIP" in its title.
* It's ok to use the CI resources to test your PR, but please don't abuse them.

### What does this PR try to resolve?

Explain the motivation behind this change.
A clear overview along with an in-depth explanation are helpful.

You can use `Fixes #<issue number>` to associate this PR to an existing issue.

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

Demonstrate how you test this change and guide reviewers through your PR.
With a smooth review process, a pull request usually gets reviewed quicker.

If you don't know how to write and run your tests, please read the guide:
https://doc.crates.io/contrib/tests

### 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-01-05 19:18:32 +00:00
Josh Triplett
65ddbbdfb3 Remove the option to disable pipelining
Cargo has had pipelining enabled by default for a long time, without
issue. Remove support for `build.pipelining = false`. (Continue parsing
the option from the config file, but ignore it.)
2022-01-05 10:25:23 -08:00
bors
c094313f9e Auto merge of #10255 - joshtriplett:unconditional-artifact-timing, r=alexcrichton
Always ask rustc for messages about artifacts, and always process them

Rather than attempt to determine which compilations require metadata and
only ask rustc to emit messages about artifacts for those compilations,
just unconditionally generate and process such messages for all
compilations.

In addition to simplifying code, this also gives us that information for
timing purposes as well, even when not pipelining.

<!--
Thanks for submitting a pull request 🎉! Here are some tips for you:

* If this is your first contribution, read "Cargo Contribution Guide":
  https://doc.crates.io/contrib/
* Run `cargo fmt --all` to format your code changes.
* Small commits and pull requests are always preferable and easy to review.
* If your idea is large and needs feedback from the community, read how:
  https://doc.crates.io/contrib/process/#working-on-large-features
* Cargo takes care of compatibility. Read our design principles:
  https://doc.crates.io/contrib/design.html
* When changing help text of cargo commands, follow the steps to generate docs:
  https://github.com/rust-lang/cargo/tree/master/src/doc#building-the-man-pages
* If your PR is not finished, set it as "draft" PR or add "WIP" in its title.
* It's ok to use the CI resources to test your PR, but please don't abuse them.

### What does this PR try to resolve?

Explain the motivation behind this change.
A clear overview along with an in-depth explanation are helpful.

You can use `Fixes #<issue number>` to associate this PR to an existing issue.

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

Demonstrate how you test this change and guide reviewers through your PR.
With a smooth review process, a pull request usually gets reviewed quicker.

If you don't know how to write and run your tests, please read the guide:
https://doc.crates.io/contrib/tests

### 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-01-05 15:23:14 +00:00
Weihang Lo
d92dceaeba
Test IO error resilience while walking directories
Remove `build_script::build_script_scan_eacces`  test case because cargo
ignores it and returns its path during a `cargo build`. The caller still
has a chance to hit the IO error if they does access it.
2022-01-05 14:29:59 +08:00
Weihang Lo
0113ec4645
Be resilient to most IO error and filesystem loop
Recover from IO errors wile walking directories, only abort when error
from `walkdir` is without an path to recover.
2022-01-05 14:28:51 +08:00
Josh Triplett
71d25f6ea9 Always ask rustc for messages about artifacts, and always process them
Rather than attempt to determine which compilations require metadata and
only ask rustc to emit messages about artifacts for those compilations,
just unconditionally generate and process such messages for all
compilations.

In addition to simplifying code, this also gives us that information for
timing purposes as well, even when not pipelining.
2022-01-04 12:38:52 -08:00
bors
358e79fe56 Auto merge of #10254 - joshtriplett:rmeta-required-no-timings, r=alexcrichton
Make rmeta_required no longer depend on whether timing is enabled

This doesn't appear to affect the quality of the timing information at
all.

If there's additional information we need from rustc about what it's
doing at any given time, we could add mechanisms to retrieve that
information, but enabling timing shouldn't force building more than we
otherwise would have.
2022-01-04 18:39:45 +00:00
bors
50840723d5 Auto merge of #10218 - weihanglo:pr-template, r=alexcrichton
The first version of pull request template

### What this PR tries to resolve?

We're trying to extract information out off the head of contributors.
Hope this help the review process more friendly for everyone.

### How to test and review this PR?

Copy this template and paste to your GitHub Web UI to see if it renders well.

### Additional information

Kubernetes community has one of the best guide of ["Best Practices for Faster Reviews"].
It describes tips for contributors tocreate a high quality PR. We might want
to create our own one and include it in PR template in the future.

In addition, I don't know how much time it take to update the changelog. I saw
some projects let PR author write down the release note of the PR. This sounds
helpful to take some burden off from maintainers, as well as let contributors
feel more involved. Anyway, it's not in this PR but is good to discuss later.

["Best Practices for Faster Reviews"]: 9b38b27064/contributors/guide/pull-requests.md (best-practices-for-faster-reviews)
2022-01-04 17:59:05 +00:00
Josh Triplett
25d1480800 Make rmeta_required no longer depend on whether timing is enabled
This doesn't appear to affect the quality of the timing information at
all.

If there's additional information we need from rustc about what it's
doing at any given time, we could add mechanisms to retrieve that
information, but enabling timing shouldn't force building more than we
otherwise would have.
2022-01-04 09:21:36 -08:00
bors
3897749d21 Auto merge of #10088 - joshtriplett:stabilize-strip, r=ehuss
Stabilize the `strip` profile option, now that rustc has stable `-C strip`

https://github.com/rust-lang/rust/pull/90058/ stabilized `-Z strip` as `-C strip`. Stabilize the corresponding Cargo option.

Update the documentation to move it from the unstable reference to the profiles documentation.

Update the tests to account for stabilization.
2022-01-04 17:11:34 +00:00
bors
35e82eb45f Auto merge of #10248 - ehuss:windows-ssh-agent, r=Eh2406
Update docs for windows ssh-agent.

This updates the documentation for SSH authentication using Windows and ssh-agent.

Per #10237 and https://github.com/rust-lang/rust/pull/92374, Cargo now supports ssh-agent on Windows.

I'm about 80% sure this information is correct based on my reading of the code and testing.  The ssh-agent that is part of mingw (or git-for-windows) uses emulated sockets, which are not compatible with traditional Windows-style named pipes.
2022-01-02 19:38:08 +00:00