Commit graph

11739 commits

Author SHA1 Message Date
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
bors 68ea4c04a2 Auto merge of #10244 - joshtriplett:tyop, r=ehuss
Fix typo: substract -> subtract
2022-01-02 16:52:05 +00:00
Eric Huss 6c69afa9e8 Update docs for windows ssh-agent. 2022-01-02 08:44:09 -08:00
Josh Triplett 64439ce376 Fix typo: substract -> subtract 2022-01-01 16:47:49 -08:00
Weihang Lo 3d9d52f358
Tweak wordings for PR template
Co-authored-by: Ruby Lazuli <general@patchmixolydic.com>
2022-01-01 15:30:41 +08:00
bors 5b3a8c58ef Auto merge of #10239 - Turbo87:patch-1, r=ehuss
timings: Fix tick mark alignment

### Before

<img width="1030" alt="Bildschirmfoto 2021-12-31 um 11 58 53" src="https://user-images.githubusercontent.com/141300/147819686-ce35da70-59d3-4174-b3c9-05e926260a4f.png">

### After

<img width="1032" alt="Bildschirmfoto 2021-12-31 um 11 58 23" src="https://user-images.githubusercontent.com/141300/147819683-a12d4387-dc30-40bc-aedc-c10fdac7e4e6.png">
2021-12-31 17:52:34 +00:00
Tobias Bieniek bd9b8f457a
timings: Fix tick mark alignment 2021-12-31 11:58:13 +01:00
bors 9af67cfb4e Auto merge of #10238 - Aaron1011:remove-lifetimes, r=joshtriplett
Remove unused lifetimes

This is blocking the Crater run in https://github.com/rust-lang/rust/pull/92413,
since a 'try' build needs to build Cargo.
2021-12-30 06:15:46 +00:00
Aaron Hill c8761d4791
Remove unused lifetimes
This is blocking the Crater run in https://github.com/rust-lang/rust/pull/92413,
since a 'try' build needs to build Cargo.
2021-12-29 23:39:15 -05:00
Josh Triplett bd550639f7
Update stabilization date for strip option
Co-authored-by: Eric Huss <eric@huss.org>
2021-12-28 09:55:12 -08:00
bors 1f12b88497 Auto merge of #10224 - MidasLamb:find-closest-capitalization, r=joshtriplett
Make levenshtein distance case insensitive.

When typing in a single character shortcut as a capital, it always
returns `b` as the suggestion as every one-letter abbreviation
is a lev distance 1 away from the capitalized one.
By making the levenshtein distance case insensitive, the case-mismatched
one-letter abbriviation (e.g. `C` to `c`) will be suggested, rather
than `b`
2021-12-24 08:33:58 +00:00
Josh Triplett 0d028608b3 Link to rustc documentation for -C strip 2021-12-23 23:40:14 -08:00
Josh Triplett 75e544d545 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, but make them no-ops on
stable/beta for now until rustc 1.58 releases.
2021-12-23 23:40:13 -08:00
Midas Lambrichts f0992e3b11 Add comment explaining the lowercasing in the levenshtein distance calculation. 2021-12-22 20:57:15 +01:00
Weihang Lo e0d02755a3
Move section titles into comment 2021-12-22 01:45:57 +08:00
Midas Lambrichts 42528799e2 Make levenshtein distance case insensitive.
When typing in a single character shortcut as a capital, it always
returns `b` as the suggestion as every one-letter abbreviation
is a lev distance 1 away from the capitalized one.
By making the levenshtein distance case insensitive, the case-mismatched
one-letter abbriviation (e.g. `C` to `c`) will be suggested, rather
than `b`
2021-12-21 12:56:28 +01:00
Weihang Lo 6f912788ed
Test cargo build being resilient to filesystem loop 2021-12-21 02:46:05 +08:00
bors 47b869c107 Auto merge of #10212 - SamMorrowDrums:patch-1, r=alexcrichton
[docs] Adds basic CI yaml for GitHub Actions

Currently there is no documentation for GitHub Actions, so I have attempted to add an Actions Workflow that is equivalent to the other CI snippets in the file. You can view a successful run of this Action in my repo for experimenting with this here: https://github.com/SamMorrowDrums/rust-action-test/actions/runs/1593666172

The Rust code I tested it with is just the boilerplate from `cargo init`.
2021-12-20 16:35:00 +00:00
Sam Morrow deee87c428 add pull_request trigger and update add note on fail case 2021-12-20 16:43:03 +01:00
Sam Morrow a7a60a5421 add information on starter workflow 2021-12-20 15:49:10 +01:00
Weihang Lo 0926c3b9c4
The first version of pull request template
We're trying to extract information out off the head of contributors.
Hope this help the review process more friendly for everyone.
2021-12-19 17:44:36 +08:00
Sam Morrow e91db920a0 further simplify the workflow 2021-12-17 20:02:11 +01:00
bors 3787309df6 Auto merge of #10209 - jonhoo:pub-manifest-from-str, r=alexcrichton
Add function for parsing already-read manifest

This makes the function formerly known as `do_read_manifest` public
under the name `read_manifest_from_str` so that Cargo-as-a-library users
can parse a manifest without re-reading a `Cargo.toml` file they have
already read from disk themselves.
2021-12-17 16:12:16 +00:00
Sam Morrow 7572047529 add in override flag to set default cargo toolchain 2021-12-17 12:02:13 +01:00
Sam Morrow bb48cd5b71
Adds basic CI yaml for GitHub Actions 2021-12-17 11:37:42 +01:00
bors fcef61230c Auto merge of #10210 - nyurik:test-help, r=ehuss
Minor docs change for `cargo test --help`

Per #10208, make `cargo test -- --help` more discoverable.
2021-12-17 02:30:38 +00:00
Yuri Astrakhan 229c7cfa28 Minor docs change for cargo test --help
Per #10208, make `cargo test -- --help` more discoverable.
2021-12-16 21:03:36 -05:00
Jon Gjengset 7e160e5110 Add function for parsing already-read manifest
This makes the function formerly known as `do_read_manifest` public
under the name `read_manifest_from_str` so that Cargo-as-a-library users
can parse a manifest without re-reading a `Cargo.toml` file they have
already read from disk themselves.
2021-12-16 15:18:53 -08:00
bors 8f8212c7ba Auto merge of #10205 - hi-rustin:rustin-patch-clippy, r=Eh2406
Make clippy happy

Remove needless borrow.
2021-12-16 22:49:38 +00:00
bors bfb7f2e083 Auto merge of #10202 - weihanglo:github-issue-config, r=alexcrichton
Enhance descriptions of issue templates

## Why

To discuss new features with larger scope, I think it's better discuss with the community, not just people in this repo. Hope these changes can guide people to a more proper place for this kind of feature request.

## Screenshots

#### Add two new types of issue template

- Question
- Inspiring Idea

<img width="500" alt="image" src="https://user-images.githubusercontent.com/14314532/146328466-f234c431-e355-4da1-a34a-b7b4c2490599.png">

#### Mention internal forum and zulip to guide user to discuss

<img width="500" alt="image" src="https://user-images.githubusercontent.com/14314532/146328580-4798983a-58d3-4e5e-9006-bf6d1d089c83.png">
2021-12-16 17:20:24 +00:00
bors 180f599f60 Auto merge of #10196 - charlesroussel:master, r=alexcrichton
Add workaround for sporadic kills when building on Macos

This is the workaround for the issue https://github.com/rust-lang/cargo/issues/10060
2021-12-16 16:36:36 +00:00
Charles Roussel c9c67c0a93 Add workaround for sporadic kills when building on Macos 2021-12-16 16:59:57 +01:00
bors b05697de66 Auto merge of #10188 - weihanglo:issue-9528, r=alexcrichton
Detect filesystem loop during walking the projects

Resolves #9528

~~This PR also adds a new dependency `same-file` but since it's already a
dependency of `cargo-util`, so nothing added actually.~~

Use `walkdir` to detect filesystem loop and gain performance boost!
2021-12-16 15:48:52 +00:00
bors b9bc3d1e86 Auto merge of #10204 - hi-rustin:rustin-patch-doc, r=alexcrichton
Error about not having any crates with documentation

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

Error about not having any crates with documentation.
2021-12-16 15:08:37 +00:00
hi-rustin 38826af279 Make clippy happy
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-12-16 22:31:03 +08:00
hi-rustin 07843ed8fb add open_no_doc_crate test
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-12-16 22:29:32 +08:00
hi-rustin 94d076703e Error when the absence of any crates with files
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-12-16 19:56:05 +08:00
Weihang Lo 5e5b1312ae
Mention forum and zulip in feature-request issue template 2021-12-16 18:53:06 +08:00