]> git.proxmox.com Git - cargo.git/log
cargo.git
2 years agoNormalize `--path` to install bin outside current workspace
Weihang Lo [Thu, 27 Jan 2022 09:58:06 +0000 (17:58 +0800)]
Normalize `--path` to install bin outside current workspace

For `Workspace::find_root`, `cargo_util::path::PathAncestors` won't do
path normalization while walking back the ancestors. The responsibility
lies in the caller. Thus, `cargo install` should normalize its `--path`
argument before passing in `SourceId::for_path` and `Workspace::new`.

`Config::reload_rooted_at` is not affected because cargo always starts
searching and merging configs from where it is invoked.

2 years agoTest: install with path outside current workspace
Weihang Lo [Thu, 27 Jan 2022 09:50:43 +0000 (17:50 +0800)]
Test: install with path outside current workspace

Make up this test case to reflect the current incorrect behavior.

2 years agoAuto merge of #10329 - ehuss:sync-toml-edit, r=alexcrichton
bors [Tue, 25 Jan 2022 22:36:53 +0000 (22:36 +0000)]
Auto merge of #10329 - ehuss:sync-toml-edit, r=alexcrichton

Sync toml_edit versions

I missed in the review of #10086 that the toml_edit versions weren't in sync everywhere.

2 years agoSync toml_edit versions
Eric Huss [Tue, 25 Jan 2022 22:33:32 +0000 (14:33 -0800)]
Sync toml_edit versions

2 years agoAuto merge of #10176 - jonhoo:config-cli-simple, r=ehuss
bors [Tue, 25 Jan 2022 17:53:34 +0000 (17:53 +0000)]
Auto merge of #10176 - jonhoo:config-cli-simple, r=ehuss

Check --config for dotted keys only

This addresses the remaining unresolved issue for `config-cli` (#7722).

2 years agoUse implicit captured format args
Jon Gjengset [Tue, 25 Jan 2022 17:37:05 +0000 (09:37 -0800)]
Use implicit captured format args

2 years agoAuto merge of #10327 - hi-rustin:rustin-patch-host, r=ehuss
bors [Tue, 25 Jan 2022 17:14:56 +0000 (17:14 +0000)]
Auto merge of #10327 - hi-rustin:rustin-patch-host, r=ehuss

Remove deprecated --host arg for search and publish cmds

### What does this PR try to resolve?

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

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

Remove deprecated --host arg for search and publish cmds.

2 years agoAuto merge of #10326 - matklad:out-dir-for-intermediates, r=alexcrichton
bors [Tue, 25 Jan 2022 16:37:11 +0000 (16:37 +0000)]
Auto merge of #10326 - matklad:out-dir-for-intermediates, r=alexcrichton

doc: it's valid to use OUT_DIR for intermediate artifacts

Eg, storing `.o` files in OUT_DIR is ok! See
https://github.com/rust-lang/cargo/issues/9661#issuecomment-1021029381
for some discussion.

2 years agoAuto merge of #10323 - ehuss:local-git-info, r=alexcrichton
bors [Tue, 25 Jan 2022 15:50:45 +0000 (15:50 +0000)]
Auto merge of #10323 - ehuss:local-git-info, r=alexcrichton

Use local git info for version.

#10178 caused an unintended change where cargo is being built twice in rust-lang/rust's CI.  It is being built once as a CLI, and a second time for RLS.  The cause is the `CFG_COMMIT_HASH` environment variable changes between those two builds (it is set for the tool being built).

The solution here is to grab the git information from cargo's own build script. This is guaranteed to always be in the `src/tools/cargo` directory for both tools.

This should help save a minute or two in the dist builders.

2 years agoRemove deprecated --host arg for search and publish cmds
hi-rustin [Tue, 25 Jan 2022 14:34:12 +0000 (22:34 +0800)]
Remove deprecated --host arg for search and publish cmds

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2 years agodoc: it's valid to use OUT_DIR for intermediate artifacts
Aleksey Kladov [Tue, 25 Jan 2022 10:22:48 +0000 (13:22 +0300)]
doc: it's valid to use OUT_DIR for intermediate artifacts

Eg, storing `.o` files in OUT_DIR is ok! See
https://github.com/rust-lang/cargo/issues/9661#issuecomment-1021029381
for some discussion.

2 years agoAuto merge of #10324 - ehuss:fix-doc-undocumented-dep, r=alexcrichton
bors [Tue, 25 Jan 2022 04:48:08 +0000 (04:48 +0000)]
Auto merge of #10324 - ehuss:fix-doc-undocumented-dep, r=alexcrichton

Fix documenting with undocumented dependencies.

#10201 introduced a bug where dependencies that have `doc=false` weren't being built at all when running `cargo doc` if the project did not have any binaries.  That means the rmeta file was missing, and the `--extern` flag was not being passed to rustdoc.

The solution is to ensure the `rmeta` file gets generated, but only skip generating the `CompileMode::Doc` unit for undocumented dependencies.

This unblocks the bootstrap bump.

2 years agoFix documenting with undocumented dependencies.
Eric Huss [Tue, 25 Jan 2022 01:10:05 +0000 (17:10 -0800)]
Fix documenting with undocumented dependencies.

2 years agoUse local git info for version.
Eric Huss [Mon, 24 Jan 2022 23:28:04 +0000 (15:28 -0800)]
Use local git info for version.

2 years agoEnforce no decorators in --config values
Jon Gjengset [Mon, 24 Jan 2022 20:05:09 +0000 (12:05 -0800)]
Enforce no decorators in --config values

2 years agoBetter example in error
Jon Gjengset [Mon, 24 Jan 2022 18:08:19 +0000 (10:08 -0800)]
Better example in error

2 years agoAvoid re-parsing config-cli toml
Jon Gjengset [Thu, 20 Jan 2022 21:28:29 +0000 (13:28 -0800)]
Avoid re-parsing config-cli toml

2 years agoMerge remote-tracking branch 'upstream/master' into config-cli-simple
Jon Gjengset [Thu, 20 Jan 2022 20:31:35 +0000 (12:31 -0800)]
Merge remote-tracking branch 'upstream/master' into config-cli-simple

2 years agoAuto merge of #10305 - weihanglo:issue-10268, r=alexcrichton
bors [Thu, 20 Jan 2022 15:07:43 +0000 (15:07 +0000)]
Auto merge of #10305 - weihanglo:issue-10268, r=alexcrichton

do not compile test for bins flagged as `test = false`

### What does this PR try to resolve?

Fixes #10268

#6683 introduced a behavior that compiles all bin targets, but for bins with `test = false` they shouldn't be compiled with `--test` as testbins.

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

In the first commit of this PR, I refines the test `test_filtered_excludes_compiling_examples` to reflect the current wrong behavior (test passed). The following two commits correct the behavior and the test accordingly. The last few commits encapsulate scattered target selection logic into functions on `CompileFilter`.

2 years agoUpdate doc for CompileFilter
Weihang Lo [Thu, 20 Jan 2022 04:52:17 +0000 (12:52 +0800)]
Update doc for CompileFilter

2 years agoUse `new_all_targets` in cargo-fix when no target selection exists
Weihang Lo [Thu, 20 Jan 2022 03:41:12 +0000 (11:41 +0800)]
Use `new_all_targets` in cargo-fix when no target selection exists

2 years agoExtract logic of single bin target filter to `single_bin`
Weihang Lo [Thu, 20 Jan 2022 04:34:57 +0000 (12:34 +0800)]
Extract logic of single bin target filter to `single_bin`

2 years agoExtract logic of lib target only filter to `lib_only`
Weihang Lo [Thu, 20 Jan 2022 03:33:11 +0000 (11:33 +0800)]
Extract logic of lib target only filter to `lib_only`

2 years agoExtract logic of all test target filter to `all_test_targets`
Weihang Lo [Thu, 20 Jan 2022 03:30:55 +0000 (11:30 +0800)]
Extract logic of all test target filter to `all_test_targets`

2 years agoAuto merge of #10086 - epage:toml, r=ehuss
bors [Thu, 20 Jan 2022 03:56:18 +0000 (03:56 +0000)]
Auto merge of #10086 - epage:toml, r=ehuss

Port cargo from toml-rs to toml_edit

Benefits:
- A TOML 1.0 compliant parser
- Unblock future work
  - Have `cargo init` add the current crate to the workspace, rather
    than error
  - #5586: Upstream `cargo-add`

TODO
- [x] Analyze performance and address regressions
- [x] Identify and resolve incompatibiies
- [x] Resolve remaining test failures, see
      https://github.com/ordian/toml_edit/labels/cargo
- [x] ~~Switch the code from https://github.com/rust-lang/cargo/pull/10176 to only parse once~~ (this PR is being merged first)

2 years agoAuto merge of #10306 - eholk:git-default-branch, r=alexcrichton
bors [Wed, 19 Jan 2022 17:09:36 +0000 (17:09 +0000)]
Auto merge of #10306 - eholk:git-default-branch, r=alexcrichton

Fix new::git_default_branch with different default

The test `new::git_default_branch` would fail if the current user had already configured a different default branch.

This patch changes the test to first write a `.gitconfig` file with the default branch set to master. This puts us in a state where we still have the old default, and then the subsequent change to the config file will make sure that config changes are still respected.

2 years agoRefactor create_empty_config to create_default_config
Eric Holk [Wed, 19 Jan 2022 16:45:03 +0000 (08:45 -0800)]
Refactor create_empty_config to create_default_config

2 years agoFix new::git_default_branch with different default
Eric Holk [Tue, 18 Jan 2022 22:51:21 +0000 (14:51 -0800)]
Fix new::git_default_branch with different default

The test new::git_default_branch would fail if the current user had
already configured a different default branch.

This patch changes the test to first write a .gitconfig file with the
default branch set to master. This puts us in a state where we still
have the old default, and then the subsequent change to the config file
will make sure that config changes are still respected.

2 years agotest: do not compile test for bins flagged as `test = false`
Weihang Lo [Tue, 18 Jan 2022 18:45:05 +0000 (02:45 +0800)]
test: do not compile test for bins flagged as `test = false`

2 years agodo not compile test for bins flagged as `test = false`
Weihang Lo [Tue, 18 Jan 2022 18:42:08 +0000 (02:42 +0800)]
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.

2 years agotest: compile all bins when `TESTNAME` arg exists
Weihang Lo [Tue, 18 Jan 2022 18:22:58 +0000 (02:22 +0800)]
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.

2 years agoAuto merge of #10243 - hi-rustin:rustin-patch-collision, r=ehuss
bors [Tue, 18 Jan 2022 17:39:35 +0000 (17:39 +0000)]
Auto merge of #10243 - hi-rustin:rustin-patch-collision, r=ehuss

Error when setting crate type of both dylib and cdylib in library

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

Error when setting crate type of both dylib and cdylib in library. Cargo can't support that at this time, since they both output the same filename.

2 years agoAuto merge of #10300 - ehuss:list-help, r=alexcrichton
bors [Tue, 18 Jan 2022 16:34:43 +0000 (16:34 +0000)]
Auto merge of #10300 - ehuss:list-help, r=alexcrichton

Include `help` in `--list`

This adds the `help` subcommand to the `--list` output. It previously was not included because `help` is handled differently from built-in subcommands.

2 years agoAuto merge of #10295 - ehuss:bash-report, r=alexcrichton
bors [Tue, 18 Jan 2022 15:59:45 +0000 (15:59 +0000)]
Auto merge of #10295 - ehuss:bash-report, r=alexcrichton

Add report subcommand to bash completion.

This adds the `cargo report` subcommand to the bash completion.

2 years agoAuto merge of #10296 - ehuss:downgrade-log, r=alexcrichton
bors [Tue, 18 Jan 2022 15:15:28 +0000 (15:15 +0000)]
Auto merge of #10296 - ehuss:downgrade-log, r=alexcrichton

Downgrade some log messages.

This lowers the log level of several "info" messages. I find that these can be quite noisy when using log messages, and I don't think need to be such a high log level.

2 years agoInclude `help` in `--list`
Eric Huss [Sun, 16 Jan 2022 19:14:04 +0000 (11:14 -0800)]
Include `help` in `--list`

2 years agoAuto merge of #10298 - hi-rustin:rustin-patch-triagebot, r=ehuss
bors [Sun, 16 Jan 2022 17:02:31 +0000 (17:02 +0000)]
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.

2 years agoError when setting crate type of both dylib and cdylib in library
hi-rustin [Sun, 16 Jan 2022 09:36:56 +0000 (17:36 +0800)]
Error when setting crate type of both dylib and cdylib in library

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2 years agoEnable shortcut for triage bot
hi-rustin [Sun, 16 Jan 2022 05:46:57 +0000 (13:46 +0800)]
Enable shortcut for triage bot

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2 years agoDowngrade some log messages.
Eric Huss [Sat, 15 Jan 2022 22:16:50 +0000 (14:16 -0800)]
Downgrade some log messages.

2 years agoAuto merge of #10294 - ehuss:version-bump, r=Eh2406
bors [Sat, 15 Jan 2022 16:42:51 +0000 (16:42 +0000)]
Auto merge of #10294 - ehuss:version-bump, r=Eh2406

Bump to 0.61.0, update changelog

2 years agoAdd report subcommand to bash completion.
Eric Huss [Fri, 14 Jan 2022 22:11:52 +0000 (14:11 -0800)]
Add report subcommand to bash completion.

2 years agoUpdate changelog for 1.59
Eric Huss [Fri, 14 Jan 2022 21:38:39 +0000 (13:38 -0800)]
Update changelog for 1.59

2 years agoBump to 0.61.0
Eric Huss [Fri, 14 Jan 2022 18:57:54 +0000 (10:57 -0800)]
Bump to 0.61.0

2 years agoAuto merge of #10291 - calebcartwright:cargo-fmt-check, r=ehuss
bors [Fri, 14 Jan 2022 00:21:19 +0000 (00:21 +0000)]
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

2 years agoci: use new cargo fmt option
Caleb Cartwright [Thu, 13 Jan 2022 23:57:25 +0000 (17:57 -0600)]
ci: use new cargo fmt option

2 years agoAuto merge of #10287 - Nilstrieb:docs-semver-check-run-fail, r=ehuss
bors [Thu, 13 Jan 2022 23:38:53 +0000 (23:38 +0000)]
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();
}
```.
```

2 years agoAuto merge of #10290 - maxwase:is_symlink_stabilized, r=Eh2406
bors [Thu, 13 Jan 2022 22:42:26 +0000 (22:42 +0000)]
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

2 years agoUse `is_symlink()` method
maxwase [Thu, 13 Jan 2022 21:36:24 +0000 (00:36 +0300)]
Use `is_symlink()` method

2 years agoPort cargo from toml-rs to toml_edit
Ed Page [Tue, 2 Nov 2021 00:18:32 +0000 (19:18 -0500)]
Port cargo from toml-rs to toml_edit

Benefits:
- A TOML 1.0 compliant parser
- Unblock future work
  - Have `cargo init` add the current crate to the workspace, rather
    than error
  - #5586: Upstream `cargo-add`

2 years agodocs: add `run-fail` to semver check
Nilstrieb [Wed, 12 Jan 2022 19:43:14 +0000 (20:43 +0100)]
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).

2 years agoAuto merge of #10269 - ehuss:stabilized-new-features, r=alexcrichton
bors [Wed, 12 Jan 2022 15:15:09 +0000 (15:15 +0000)]
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

2 years agoAuto merge of #10265 - epage:clap-port, r=joshtriplett
bors [Tue, 11 Jan 2022 23:47:29 +0000 (23:47 +0000)]
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.

2 years agoAuto merge of #10217 - zhamlin:feat/profile-rustflags, r=ehuss
bors [Mon, 10 Jan 2022 16:56:16 +0000 (16:56 +0000)]
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

2 years agofeat: support rustflags per profile
Zach Hamlin [Sun, 19 Dec 2021 03:31:32 +0000 (21:31 -0600)]
feat: support rustflags per profile

2 years agoStabilize namespaced and weak dependency features.
Eric Huss [Thu, 6 Jan 2022 23:46:15 +0000 (15:46 -0800)]
Stabilize namespaced and weak dependency features.

2 years agoAuto merge of #10267 - joshtriplett:pr-template-bors-comments, r=alexcrichton
bors [Thu, 6 Jan 2022 21:52:20 +0000 (21:52 +0000)]
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

2 years agoMake bors ignore the PR template so it doesn't end up in merge messages
Josh Triplett [Thu, 6 Jan 2022 20:24:12 +0000 (12:24 -0800)]
Make bors ignore the PR template so it doesn't end up in merge messages

2 years agorefactor: Resolve Arg::multiple deprecation
Ed Page [Thu, 6 Jan 2022 15:13:24 +0000 (09:13 -0600)]
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.

2 years agorefactor: Resolve SubCommand::with_new deprecation
Ed Page [Thu, 6 Jan 2022 02:09:07 +0000 (20:09 -0600)]
refactor: Resolve SubCommand::with_new deprecation

2 years agorefactor: Resolve App::settings deprecation
Ed Page [Thu, 6 Jan 2022 02:04:05 +0000 (20:04 -0600)]
refactor: Resolve App::settings deprecation

2 years agorefactor: Resolve App::help deprecation
Ed Page [Thu, 6 Jan 2022 02:03:25 +0000 (20:03 -0600)]
refactor: Resolve App::help deprecation

2 years agorefactor: Resolve App::template deprecation
Ed Page [Thu, 6 Jan 2022 02:02:51 +0000 (20:02 -0600)]
refactor: Resolve App::template deprecation

2 years agorefactor: Resolve App::usage deprecation
Ed Page [Thu, 6 Jan 2022 02:02:37 +0000 (20:02 -0600)]
refactor: Resolve App::usage deprecation

2 years agorefactor: Resolve App::get_matches_safe deprecation
Ed Page [Thu, 6 Jan 2022 02:01:33 +0000 (20:01 -0600)]
refactor: Resolve App::get_matches_safe deprecation

2 years agorefactor: Resolve AppSettings::UnifiedHelpMessage deprecation
Ed Page [Thu, 6 Jan 2022 02:02:01 +0000 (20:02 -0600)]
refactor: Resolve AppSettings::UnifiedHelpMessage deprecation

2 years agorefactor: Resolve Arg::empty_values deprecation
Ed Page [Thu, 6 Jan 2022 02:05:18 +0000 (20:05 -0600)]
refactor: Resolve Arg::empty_values deprecation

2 years agorefactor: Resolve Arg::hidden deprecation
Ed Page [Thu, 6 Jan 2022 02:00:47 +0000 (20:00 -0600)]
refactor: Resolve Arg::hidden deprecation

2 years agorefactor: Resolve Arg::with_name deprecation
Ed Page [Thu, 6 Jan 2022 02:00:18 +0000 (20:00 -0600)]
refactor: Resolve Arg::with_name deprecation

2 years agoUpgrade to Clap 3
Ed Page [Tue, 4 Jan 2022 17:04:50 +0000 (11:04 -0600)]
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

2 years agoAuto merge of #10214 - weihanglo:revert-10188-issue-9528, r=alexcrichton
bors [Wed, 5 Jan 2022 22:10:29 +0000 (22:10 +0000)]
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.

2 years agoAuto merge of #10258 - joshtriplett:unconditional-pipelining, r=alexcrichton
bors [Wed, 5 Jan 2022 19:18:32 +0000 (19:18 +0000)]
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.
-->

2 years agoRemove the option to disable pipelining
Josh Triplett [Tue, 4 Jan 2022 23:40:33 +0000 (15:40 -0800)]
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.)

2 years agoAuto merge of #10255 - joshtriplett:unconditional-artifact-timing, r=alexcrichton
bors [Wed, 5 Jan 2022 15:23:14 +0000 (15:23 +0000)]
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.
-->

2 years agoTest IO error resilience while walking directories
Weihang Lo [Mon, 20 Dec 2021 18:59:41 +0000 (02:59 +0800)]
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.

2 years agoBe resilient to most IO error and filesystem loop
Weihang Lo [Mon, 20 Dec 2021 18:58:50 +0000 (02:58 +0800)]
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.

2 years agoAlways ask rustc for messages about artifacts, and always process them
Josh Triplett [Tue, 4 Jan 2022 20:33:45 +0000 (12:33 -0800)]
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.

2 years agoAuto merge of #10254 - joshtriplett:rmeta-required-no-timings, r=alexcrichton
bors [Tue, 4 Jan 2022 18:39:45 +0000 (18:39 +0000)]
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.

2 years agoAuto merge of #10218 - weihanglo:pr-template, r=alexcrichton
bors [Tue, 4 Jan 2022 17:59:05 +0000 (17:59 +0000)]
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"]: https://github.com/kubernetes/community/blob/9b38b270640009f28d7d8710f74d955e0c374cef/contributors/guide/pull-requests.md#best-practices-for-faster-reviews

2 years agoMake rmeta_required no longer depend on whether timing is enabled
Josh Triplett [Tue, 4 Jan 2022 17:21:36 +0000 (09:21 -0800)]
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.

2 years agoAuto merge of #10088 - joshtriplett:stabilize-strip, r=ehuss
bors [Tue, 4 Jan 2022 17:11:34 +0000 (17:11 +0000)]
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.

2 years agoAuto merge of #10248 - ehuss:windows-ssh-agent, r=Eh2406
bors [Sun, 2 Jan 2022 19:38:08 +0000 (19:38 +0000)]
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.

2 years agoAuto merge of #10244 - joshtriplett:tyop, r=ehuss
bors [Sun, 2 Jan 2022 16:52:05 +0000 (16:52 +0000)]
Auto merge of #10244 - joshtriplett:tyop, r=ehuss

Fix typo: substract -> subtract

2 years agoUpdate docs for windows ssh-agent.
Eric Huss [Sun, 2 Jan 2022 16:44:09 +0000 (08:44 -0800)]
Update docs for windows ssh-agent.

2 years agoFix typo: substract -> subtract
Josh Triplett [Sun, 2 Jan 2022 00:47:49 +0000 (16:47 -0800)]
Fix typo: substract -> subtract

2 years agoTweak wordings for PR template
Weihang Lo [Sat, 1 Jan 2022 07:30:41 +0000 (15:30 +0800)]
Tweak wordings for PR template

Co-authored-by: Ruby Lazuli <general@patchmixolydic.com>
2 years agoAuto merge of #10239 - Turbo87:patch-1, r=ehuss
bors [Fri, 31 Dec 2021 17:52:34 +0000 (17:52 +0000)]
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">

2 years agotimings: Fix tick mark alignment
Tobias Bieniek [Fri, 31 Dec 2021 10:58:13 +0000 (11:58 +0100)]
timings: Fix tick mark alignment

2 years agoAuto merge of #10238 - Aaron1011:remove-lifetimes, r=joshtriplett
bors [Thu, 30 Dec 2021 06:15:46 +0000 (06:15 +0000)]
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.

2 years agoRemove unused lifetimes
Aaron Hill [Thu, 30 Dec 2021 04:39:15 +0000 (23:39 -0500)]
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.

2 years agoUpdate stabilization date for strip option
Josh Triplett [Tue, 28 Dec 2021 17:55:12 +0000 (09:55 -0800)]
Update stabilization date for strip option

Co-authored-by: Eric Huss <eric@huss.org>
2 years agoAuto merge of #10224 - MidasLamb:find-closest-capitalization, r=joshtriplett
bors [Fri, 24 Dec 2021 08:33:58 +0000 (08:33 +0000)]
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`

2 years agoLink to rustc documentation for `-C strip`
Josh Triplett [Fri, 24 Dec 2021 07:33:10 +0000 (23:33 -0800)]
Link to rustc documentation for `-C strip`

2 years agoStabilize the `strip` profile option, now that rustc has stable `-C strip`
Josh Triplett [Tue, 16 Nov 2021 23:27:57 +0000 (00:27 +0100)]
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.

2 years agoAdd comment explaining the lowercasing in the levenshtein distance calculation.
Midas Lambrichts [Wed, 22 Dec 2021 19:57:15 +0000 (20:57 +0100)]
Add comment explaining the lowercasing in the levenshtein distance calculation.

2 years agoMove section titles into comment
Weihang Lo [Tue, 21 Dec 2021 17:44:11 +0000 (01:44 +0800)]
Move section titles into comment

2 years agoMake levenshtein distance case insensitive.
Midas Lambrichts [Tue, 21 Dec 2021 11:56:28 +0000 (12:56 +0100)]
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`

2 years agoTest cargo build being resilient to filesystem loop
Weihang Lo [Mon, 20 Dec 2021 18:46:05 +0000 (02:46 +0800)]
Test cargo build being resilient to filesystem loop

2 years agoAuto merge of #10212 - SamMorrowDrums:patch-1, r=alexcrichton
bors [Mon, 20 Dec 2021 16:35:00 +0000 (16:35 +0000)]
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`.

2 years agoadd pull_request trigger and update add note on fail case
Sam Morrow [Mon, 20 Dec 2021 15:43:03 +0000 (16:43 +0100)]
add pull_request trigger and update add note on fail case