]> git.proxmox.com Git - cargo.git/log
cargo.git
2 years agoSupport inheriting jobserver fd for external subcommands
Weihang Lo [Wed, 23 Mar 2022 06:54:30 +0000 (14:54 +0800)]
Support inheriting jobserver fd for external subcommands

If cargo detects the existence of a jobserver, cargo should pass the
jobserver down to the external subcommand. Here are the reasons:

1. The existence of jobserver implies the user "expects" the amount of
   job is under control. However, before this commit, external
   subcommands cannnot benefit from the global view of the jobserver.
2. `cargo-clippy` as an external subcommand migth also love to respect
   the jobserver protocol.
3. There are several well-known external subcommands calling "cargo"
   interally (cargo-fuzz, cargo-tarpaulin, etc.)

Caveats:

Job without special prefix `+` might still be considered as a sub-make
and would inherit the jobserver, though I don't see it as an issue.

According to GNU Make Manual "13.1.1 POSIX Jobserver Interaction" [^1],
if `--jobserver-auth` option is available in `MAKEFLAGS` but the file
descriptors are closed, it means that the calling `make` didn't consider
our tool awas a recursive `make` invocation. I make an assumption that
if those fds are still open, we are happy to use those jobserver tokens.

[^1]: https://www.gnu.org/software/make/manual/make.html#POSIX-Jobserver

2 years agotest: external subcommand inherits jobserver
Weihang Lo [Sat, 26 Mar 2022 10:08:11 +0000 (18:08 +0800)]
test: external subcommand inherits jobserver

2 years agoAuto merge of #10497 - Muscraft:rfc2906-part1, r=epage
bors [Fri, 25 Mar 2022 08:19:16 +0000 (08:19 +0000)]
Auto merge of #10497 - Muscraft:rfc2906-part1, r=epage

Part 1 of RFC2906 - Packages can inherit fields from their root workspace

Tracking issue: #8415
RFC: rust-lang/rfcs#2906

All changes were heavily inspired by #8664 and #9684

A big thanks to both `@yaymukund` and `@ParkMyCar.` I pulled a lot of inspiration from their branches.

I would also like to thank `@alexcrichton` for all the feedback on the first attempt. It has brought this into a much better state.

All changes have been made according to the RFC as well as `@alexcrichton's` [comment](https://github.com/rust-lang/cargo/pull/8664#issuecomment-704878103).

This is part 1 of many, as described by [this comment](https://github.com/rust-lang/cargo/pull/9684#issuecomment-943567692), [this comment](https://github.com/rust-lang/cargo/pull/9684#pullrequestreview-779070283) and redefined  [by this one](https://github.com/rust-lang/cargo/pull/10497#issuecomment-1076301312).

This PR focuses on inheriting in root package, including:
- Add `MaybeWorkspace<T>` to allow for `{ workspace = true }`
- Add a new variant to `TomlDependency` to allow inheriting dependencies from a workspace
- Add `InheritableFields` so that we have somewhere to get a value from when we `resolve` a `MaybeWorkspace<T>`
  - `license_file` and `readme` are in `InheritableFields` in this part but are not `MaybeWorkspace` for reasons [described here](https://github.com/rust-lang/cargo/pull/10497#issuecomment-1076470424)
- Add a method to `resolve` a `MaybeWorkspace<T>` into a `T` that can fail if we have nowhere to pull from or the workspace does not define that field
- Disallow inheriting from a different `Cargo.toml`
  - This means that you can only inherit from inside the same `Cargo.toml`, i.e. it has both a `[workspace]` and a `[package]`
  - Forcing this requirement allows us to test the implementations of `MaybeWorkspace<T>` and the new `TomlDependency` variant without having to add searching for a workspace root and the complexity with it

Remaining implementation work for the RFC
- Support inheriting in any workspace member
- Correctly inherit fields that are relative paths
  - Including adding support for inheriting `license_file`,  `readme`, and path-dependencies
-  Path dependencies infer version directive
- Lock workspace dependencies and warn when unused
- Optimizations, as needed
- Evaluate any new fields for being inheritable (e.g. `rust-version`)
- Evaluate making users of `{ workspace = true }` define the workspace they pull from in `[package]`

Areas of concern:
- `TomlDependency` Deserialization is a mess, and I could not figure out how to do it in a cleaner way without significant headaches. I ended up having to do the same thing as last time [which was an issue](https://github.com/rust-lang/cargo/pull/9684#discussion_r728444103).
- Resolving on a `MaybeWorkspace` feels extremely verbose currently:
  ```rust
  project.homepage.clone().map(|mw| mw.resolve(&features, "homepage", || get_ws(inheritable)?.homepage())).transpose()?,
  ```
  This way allows for lazy resolution of inheritable fields and finding a workspace (in part 2) so you do not pay a penalty for not using this feature. The other bit of good news is `&features` will go away as it is just feature checking currently.

- This feature requires some level of duplication of code as well as remaking the original `TomlManifest` which adds extra length to the changes.
- This feature also takes a linear process and makes it potentially non-linear which adds lots of complexity (which will get worse in Part 2)

Please let me know if you have any feedback or suggestions!

2 years agoAuto merge of #10495 - ehuss:remove-profile-panic-inherit, r=weihanglo
bors [Fri, 25 Mar 2022 07:37:29 +0000 (07:37 +0000)]
Auto merge of #10495 - ehuss:remove-profile-panic-inherit, r=weihanglo

Remove unused profile support for -Zpanic-abort-tests

This removes the vestigial `PanicSetting::Inherit` setting.

This was initially introduced in #7460 which added `-Zpanic-abort-tests`. This was needed at the time because `test` and `dev` profiles were separate, but they were inter-mixed when running `cargo test`. That would cause a problem if the unwind/abort settings were mixed.  However, with named profiles, `test` now inherits from `dev`, so this is no longer necessary. Now that named profiles are stable, support for the old form is no longer necessary.

2 years agoAuto merge of #10470 - arlosi:http, r=Eh2406
bors [Thu, 24 Mar 2022 22:28:19 +0000 (22:28 +0000)]
Auto merge of #10470 - arlosi:http, r=Eh2406

HTTP registry implementation

Implement HTTP registry support described in [RFC 2789](https://github.com/rust-lang/rfcs/pull/2789).

Adds a new unstable flag `-Z http-registry` which allows cargo to interact with remote registries served over http rather than git. These registries can be identified by urls starting with `sparse+http://` or `sparse+https://`.

When fetching index metadata over http, cargo only downloads the metadata for needed crates, which can save significant time and bandwidth over git.

The format of the http index is identical to a checkout of a git-based index.

This change is based on `@jonhoo's` PR #8890.

cc `@Eh2406`

Remaining items:
- [x] Performance measurements
- [x] Make unstable only
- [x] Investigate unification of download system. Probably best done in separate change.
- [x] Unify registry tests (code duplication in `http_registry.rs`)
- [x] Use existing on-disk cache, rather than adding a new one.

2 years agoAuto merge of #10501 - ehuss:capacity-notice2, r=weihanglo
bors [Thu, 24 Mar 2022 21:45:34 +0000 (21:45 +0000)]
Auto merge of #10501 - ehuss:capacity-notice2, r=weihanglo

Add a notice about review capacity.

This adds a notice to let people know about the limited review capacity on the team.

2 years agoAdd a notice about review capacity.
Eric Huss [Wed, 23 Mar 2022 20:53:40 +0000 (13:53 -0700)]
Add a notice about review capacity.

2 years ago-- renamed deduplicate_workspace to inheritable_workspace_fields
scott [Wed, 23 Mar 2022 21:47:06 +0000 (16:47 -0500)]
-- renamed deduplicate_workspace to inheritable_workspace_fields
-- removed `[]` from error messages in favor of back-ticks

2 years agoAuto merge of #10047 - jonhoo:ignore-symlink-dir, r=ehuss
bors [Wed, 23 Mar 2022 21:08:35 +0000 (21:08 +0000)]
Auto merge of #10047 - jonhoo:ignore-symlink-dir, r=ehuss

Add tests for ignoring symlinks

This adds tests for the expected behavior in https://github.com/rust-lang/cargo/issues/10032. Interestingly, these tests pass (🎉). Will update that issue with more details shortly, but figured these tests were worthwhile to add to the testsuite anyway now that I've written them.

2 years ago-- updated both `resolve` to only take a get_ws
scott [Wed, 23 Mar 2022 18:40:16 +0000 (13:40 -0500)]
-- updated both `resolve` to only take a get_ws
-- `resolve` not takes `get_ws: impl FnOnce() -> CargoResult<T>`
-- removed `MaybeWorkspace` from `readme` and `license-file`
-- changed error messages and test names

2 years agoAdd tests for ignoring symlinks
Jon Gjengset [Fri, 5 Nov 2021 21:57:40 +0000 (14:57 -0700)]
Add tests for ignoring symlinks

2 years ago-- Part 1 of RFC2906
scott [Tue, 22 Mar 2022 02:27:49 +0000 (21:27 -0500)]
-- Part 1 of RFC2906

2 years agoRemove unused profile support for -Zpanic-abort-tests
Eric Huss [Mon, 21 Mar 2022 21:25:42 +0000 (14:25 -0700)]
Remove unused profile support for -Zpanic-abort-tests

2 years agoAuto merge of #10494 - ehuss:deps-of-doc, r=Eh2406
bors [Mon, 21 Mar 2022 21:19:23 +0000 (21:19 +0000)]
Auto merge of #10494 - ehuss:deps-of-doc, r=Eh2406

Update doc string for deps_of/compute_deps.

I noticed the `compute_deps` doc string was outdated due to some recent refactorings.  This updates the doc comments to try to clarify them and make them more accurate.

2 years agoUpdate doc string for deps_of/compute_deps.
Eric Huss [Mon, 21 Mar 2022 19:44:21 +0000 (12:44 -0700)]
Update doc string for deps_of/compute_deps.

2 years agoAuto merge of #10394 - dtolnay-contrib:displayerror, r=ehuss
bors [Mon, 21 Mar 2022 18:48:36 +0000 (18:48 +0000)]
Auto merge of #10394 - dtolnay-contrib:displayerror, r=ehuss

Consistently use crate::display_error on errors during drain

As suggested in https://github.com/rust-lang/cargo/pull/10383#discussion_r808178038 and https://github.com/rust-lang/cargo/pull/10383#discussion_r808182199.

2 years agoHTTP registry implementation
Arlo Siemsen [Wed, 9 Mar 2022 22:10:22 +0000 (14:10 -0800)]
HTTP registry implementation

2 years agoAuto merge of #10482 - arlosi:refactor_load, r=Eh2406
bors [Thu, 17 Mar 2022 21:43:09 +0000 (21:43 +0000)]
Auto merge of #10482 - arlosi:refactor_load, r=Eh2406

Refactor RegistryData::load to handle management of the index cache

Enables registry implementations to signal if the cache is valid on a per-request basis.

Fixes a bug introduced by #10064 that caused Cargo not to update for several cases in a release build because it believed the index cache to be valid when it was not. The issue only occurred in release builds because debug builds verify that the cache contents is correct (by refreshing it).

Previously `current_version` was called by the index to determine whether the cache was valid. In the new model, `RegistryData::load` is passed the current version of the cache and returns an enum to indicate the status of the cached data.

r? `@eh2406`
cc `@ehuss`

2 years agoRefactor RegistryData::load to handle management of the index cache itself.
Arlo Siemsen [Wed, 16 Mar 2022 20:23:48 +0000 (13:23 -0700)]
Refactor RegistryData::load to handle management of the index cache itself.

This enables registry implementations to signal if the cache is valid
on a per-request basis.

Fixes a bug introduced by #10064 that caused Cargo not to update for
several cases in a release build because it believed the index cache to
be valid when it was not.

2 years agoAuto merge of #10483 - cuviper:vcs--, r=Eh2406
bors [Thu, 17 Mar 2022 17:17:11 +0000 (17:17 +0000)]
Auto merge of #10483 - cuviper:vcs--, r=Eh2406

Separate VCS command paths with "--"

When building a VCS command, there may be ambiguity if a relative path
looks like an option, like "-path" or "--path". All of the VCS commands
that we use support a bare "--" separator for non-option arguments,
which is good practice to apply here.

This does not affect the cargo CLI, as it already makes sure to use
absolute paths for these calls via `value_of_path()`.

2 years agoSeparate VCS command paths with "--"
Josh Stone [Thu, 17 Mar 2022 16:31:59 +0000 (09:31 -0700)]
Separate VCS command paths with "--"

When building a VCS command, there may be ambiguity if a relative path
looks like an option, like "-path" or "--path". All of the VCS commands
that we use support a bare "--" separator for non-option arguments,
which is good practice to apply here.

This does not affect the cargo CLI, as it already makes sure to use
absolute paths for these calls via `value_of_path()`.

2 years agoPrint only Message::Finish errors all the time
David Tolnay [Wed, 16 Mar 2022 03:31:27 +0000 (20:31 -0700)]
Print only Message::Finish errors all the time

2 years agoAuto merge of #10433 - Byron:fix-#10431, r=ehuss
bors [Wed, 16 Mar 2022 02:40:40 +0000 (02:40 +0000)]
Auto merge of #10433 - Byron:fix-#10431, r=ehuss

Fix panic when artifact target is used for `[target.'cfg(<target>)'.dependencies`

With an artifact dependency like this in package `a`…

```toml
[dependencies.a]
path = "b"
artifact = "bin"
target = "$TARGET"
```

…and when using `$TARGET` like this in another package `b`…

```toml
[target.'cfg(target_arch = "$ARCHOF_$TARGET")'.dependencies]
c = { path = "../c" }
```

…it panics with `thread 'main' panicked at 'activated_features for invalid package: features did not find PackageId <dbg-info>`, but we would expect this to work normally.

### Tasks

- [x] reproduce issue in new test
   - [x] figure out why the test is fixed but the real-world example isn't
- [x] find a fix

Fixes #10431 and  #10452.

2 years agoAuto merge of #10479 - weihanglo:bump-git2, r=ehuss
bors [Tue, 15 Mar 2022 03:23:58 +0000 (03:23 +0000)]
Auto merge of #10479 - weihanglo:bump-git2, r=ehuss

Bump git2@0.14.2 and libgit2-sys@0.13.2

2 years agoBump git2@0.14.2 and libgit2-sys@0.13.2
Weihang Lo [Mon, 14 Mar 2022 23:22:00 +0000 (07:22 +0800)]
Bump git2@0.14.2 and libgit2-sys@0.13.2

The previous libgit2-sys release forgot to include the fix of libgit2 1.4.2.
https://github.com/rust-lang/git2-rs/pull/820#issuecomment-1064284814
That might cause problems when people don't have "Git for Windows"
installed on their machines.

2 years agoUndo a prior change to fix #10452
Sebastian Thiel [Mon, 14 Mar 2022 03:01:28 +0000 (11:01 +0800)]
Undo a prior change to fix #10452

2 years agoreproduce: wrong features in a build script for a shared dependency (#10452)
Sebastian Thiel [Sat, 5 Mar 2022 02:01:16 +0000 (10:01 +0800)]
reproduce: wrong features in a build script for a shared dependency (#10452)

2 years agoRemove prior hack and replace it with a proper solution
Sebastian Thiel [Mon, 14 Mar 2022 02:24:02 +0000 (10:24 +0800)]
Remove prior hack and replace it with a proper solution

This is the diff from
https://github.com/rust-lang/cargo/pull/10433#issuecomment-1064577586
applied to the codebase with the previous hack removed.

Thanks a million to @ehuss who has the insight to find fixes like this.

2 years agoAuto merge of #10448 - aeikum:fix_vendor_sync, r=weihanglo
bors [Sat, 12 Mar 2022 00:24:43 +0000 (00:24 +0000)]
Auto merge of #10448 - aeikum:fix_vendor_sync, r=weihanglo

vendor: Don't allow multiple values for --sync

The --sync argument to cargo vendor currently takes a list, which makes it easy for it to eat the final path argument:

````
cargo vendor --manifest-path foo/Cargo.toml -s bar/Cargo.toml ./test_vendor/
error: failed to read ./test_vendor/

Caused by:
  No such file or directory (os error 2)
````

Per discussion on #10441, this behavior is undesirable and hopefully used infrequently enough that we can change the UI for it. This patch will now only allow one value per --sync argument.

I didn't regenerate other doc files as it's not clear to me how/when that should be done.

2 years agovendor: Don't allow multiple values for --sync
Andrew Eikum [Wed, 2 Mar 2022 14:41:44 +0000 (08:41 -0600)]
vendor: Don't allow multiple values for --sync

2 years agoAuto merge of #10471 - Eh2406:credential_process, r=weihanglo
bors [Fri, 11 Mar 2022 15:50:15 +0000 (15:50 +0000)]
Auto merge of #10471 - Eh2406:credential_process, r=weihanglo

Use types to make clere (credential process || token)

`RegistryConfig` represents what credentials we have read from disk. It was a
```
   token: Option<String>,
   credential_process: Option<(PathBuf, Vec<String>)>,
```
with runtime checks that they were not both `Some`.
This changes it to be an Enum `None|Token|Process`.
There is somewhat more code, but I think this is clearer.

This also changed some `Option<String>` arguments to `Option<&str>`.

2 years agodont need index in the type
Jacob Finkelman [Wed, 9 Mar 2022 23:51:35 +0000 (23:51 +0000)]
dont need index in the type

2 years agoAuto merge of #10316 - hi-rustin:rustin-patch-proc_macro, r=weihanglo
bors [Thu, 10 Mar 2022 00:41:25 +0000 (00:41 +0000)]
Auto merge of #10316 - hi-rustin:rustin-patch-proc_macro, r=weihanglo

Warning on conflicting keys

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
### What does this PR try to resolve?

close https://github.com/rust-lang/cargo/issues/10299 and close https://github.com/rust-lang/cargo/issues/10317

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

- Warning on conflicting proc_macro and crate_types keys.
- Warning on conflicting dev-dependencies, build-dependencies, and default-features keys.

2 years agoat rest we can either have a credential process or a token
Jacob Finkelman [Wed, 9 Mar 2022 23:51:35 +0000 (23:51 +0000)]
at rest we can either have a credential process or a token

2 years agoAuto merge of #10064 - arlosi:poll, r=Eh2406
bors [Wed, 9 Mar 2022 19:30:19 +0000 (19:30 +0000)]
Auto merge of #10064 - arlosi:poll, r=Eh2406

Registry functions return Poll to enable parallel fetching of index data

Adds `Poll` as a return type for several registry functions to enable parallel fetching of crate metadata with a future http-based registry.

Work is scheduled by calling the `query` and related functions, then waited on with `block_until_ready`.

This PR is based on the draft PR started by eh2406 here [#8985](https://github.com/rust-lang/cargo/pull/8985).

r? `@Eh2406`
cc `@alexcrichton`
cc `@jonhoo`

2 years agocargo fmt
Jacob Finkelman [Wed, 9 Mar 2022 19:27:49 +0000 (19:27 +0000)]
cargo fmt

2 years agoAuto merge of #10468 - weihanglo:contrib-doc-refine, r=ehuss
bors [Wed, 9 Mar 2022 17:12:06 +0000 (17:12 +0000)]
Auto merge of #10468 - weihanglo:contrib-doc-refine, r=ehuss

Refine the contributor guide

2 years agoUse warn_on_deprecated
hi-rustin [Wed, 9 Mar 2022 15:54:17 +0000 (23:54 +0800)]
Use warn_on_deprecated

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2 years agoWarning on conflicting dev_dependencies keys of platform
hi-rustin [Wed, 9 Feb 2022 14:39:33 +0000 (22:39 +0800)]
Warning on conflicting dev_dependencies keys of platform

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2 years agoWarning on conflicting build_dependencies keys of platform
hi-rustin [Wed, 9 Feb 2022 14:31:09 +0000 (22:31 +0800)]
Warning on conflicting build_dependencies keys of platform

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2 years agoWarning on conflicting default_features keys
hi-rustin [Wed, 9 Feb 2022 14:15:29 +0000 (22:15 +0800)]
Warning on conflicting default_features keys

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2 years agoWarning on conflicting build_dependencies keys
hi-rustin [Wed, 9 Feb 2022 14:02:18 +0000 (22:02 +0800)]
Warning on conflicting build_dependencies keys

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2 years agoWarning on conflicting dev-dependencies keys
hi-rustin [Wed, 9 Feb 2022 13:59:26 +0000 (21:59 +0800)]
Warning on conflicting dev-dependencies keys

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2 years agoWarning on conflicting crate_types keys
hi-rustin [Sun, 23 Jan 2022 09:20:39 +0000 (17:20 +0800)]
Warning on conflicting crate_types keys

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2 years agoWarning on conflicting proc_macro
hi-rustin [Sat, 22 Jan 2022 04:55:19 +0000 (12:55 +0800)]
Warning on conflicting proc_macro

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2 years agoCall out the contributor guide on the readme
Weihang Lo [Wed, 9 Mar 2022 02:09:13 +0000 (10:09 +0800)]
Call out the contributor guide on the readme

2 years agoReuse "Before hacking on Cargo" to emphasize discussion before hacking
Weihang Lo [Wed, 9 Mar 2022 02:05:59 +0000 (10:05 +0800)]
Reuse "Before hacking on Cargo" to emphasize discussion before hacking

2 years agoAuto merge of #10438 - rukai:deny_clippy, r=ehuss
bors [Wed, 9 Mar 2022 02:32:56 +0000 (02:32 +0000)]
Auto merge of #10438 - rukai:deny_clippy, r=ehuss

Remove remaining 2 warn(clippy::*) instances

2 years agoAdd a section "Before hacking on Cargo"
Weihang Lo [Wed, 9 Mar 2022 01:45:44 +0000 (09:45 +0800)]
Add a section "Before hacking on Cargo"

The intent is redirecting contributor to know how we manage features and
bugs and hope they start some discussions first.

2 years agoRemove warn(clippy::*)
Lucas Kent [Tue, 8 Mar 2022 22:52:05 +0000 (09:52 +1100)]
Remove warn(clippy::*)

2 years agoAuto merge of #10427 - weihanglo:drop-num_cpus, r=joshtriplett
bors [Tue, 8 Mar 2022 17:07:30 +0000 (17:07 +0000)]
Auto merge of #10427 - weihanglo:drop-num_cpus, r=joshtriplett

Use `available_parallelism` instead of `num_cpus`

2 years agoPull Request feedback
Arlo Siemsen [Mon, 7 Mar 2022 19:44:44 +0000 (11:44 -0800)]
Pull Request feedback

2 years agoAuto merge of #10456 - hi-rustin:rustin-patch-network, r=alexcrichton
bors [Mon, 7 Mar 2022 16:38:27 +0000 (16:38 +0000)]
Auto merge of #10456 - hi-rustin:rustin-patch-network, r=alexcrichton

Wait up to one second while waiting for curl

### What does this PR try to resolve?

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

Wait up to one second while waiting for curl.

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

1. Build cargo
2. Start a network transfer (cargo fetch).
3. Pull the network cord.
4. Wait.

2 years agoAuto merge of #10460 - Eh2406:coverage, r=alexcrichton
bors [Mon, 7 Mar 2022 16:02:18 +0000 (16:02 +0000)]
Auto merge of #10460 - Eh2406:coverage, r=alexcrichton

Improve code coverage

Remove some unused and private methods, and add a test.

cc:
- https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/test.20coverage
- https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/If.20RFC.203231.20Private.20tokens.20on.20the.20command.20line

2 years agoadd a test for login on stdin
Jacob Finkelman [Fri, 4 Mar 2022 23:05:48 +0000 (23:05 +0000)]
add a test for login on stdin

2 years agoRemove some dead code in SourceMap
Jacob Finkelman [Fri, 4 Mar 2022 22:19:50 +0000 (22:19 +0000)]
Remove some dead code in SourceMap

2 years agoAuto merge of #10458 - Eh2406:console-history, r=ehuss
bors [Fri, 4 Mar 2022 20:54:46 +0000 (20:54 +0000)]
Auto merge of #10458 - Eh2406:console-history, r=ehuss

Don't recommend leaking tokens into the console history

Passing a secret on the command line leeks it into the history witch is available to other applications on the same system.

Removing the functionality is a braking change, a big ask. But it is not hard to change the docs to not recommend using `cargo login` that way.

cc:
- https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/If.20RFC.203231.20Private.20tokens.20on.20the.20command.20line
- https://github.com/rust-lang/rfcs/pull/3231#discussion_r812435273

2 years agoprompt not propt
Jacob Finkelman [Fri, 4 Mar 2022 19:52:10 +0000 (14:52 -0500)]
prompt not propt

Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2 years agoAuto merge of #10454 - cuishuang:master, r=ehuss
bors [Fri, 4 Mar 2022 18:38:58 +0000 (18:38 +0000)]
Auto merge of #10454 - cuishuang:master, r=ehuss

fix some typos

2 years agoDon't recommend leaking tokens into the console history
Jacob Finkelman [Fri, 4 Mar 2022 17:24:36 +0000 (17:24 +0000)]
Don't recommend leaking tokens into the console history

2 years agoWait up to one second while waiting for curl
hi-rustin [Fri, 4 Mar 2022 14:06:26 +0000 (22:06 +0800)]
Wait up to one second while waiting for curl

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2 years agofix some typos
cuishuang [Fri, 4 Mar 2022 05:41:18 +0000 (13:41 +0800)]
fix some typos

Signed-off-by: cuishuang <imcusg@gmail.com>
2 years agoAuto merge of #10453 - notriddle:notriddle/vec-extend, r=weihanglo
bors [Fri, 4 Mar 2022 01:27:18 +0000 (01:27 +0000)]
Auto merge of #10453 - notriddle:notriddle/vec-extend, r=weihanglo

Use `extend` instead of `push`ing in a loop

2 years agoUse `extend` instead of `push`ing in a loop
Michael Howell [Thu, 3 Mar 2022 23:02:13 +0000 (16:02 -0700)]
Use `extend` instead of `push`ing in a loop

2 years agoAuto merge of #10449 - Eh2406:locked_version, r=alexcrichton
bors [Thu, 3 Mar 2022 20:20:13 +0000 (20:20 +0000)]
Auto merge of #10449 - Eh2406:locked_version, r=alexcrichton

Use locked_version more

In #9847 we added better tracking for when a requirement came from a lockfile. This uses that tracking in a few more error messages.

Closes #10391

2 years agoadd a test
Jacob Finkelman [Thu, 3 Mar 2022 18:30:44 +0000 (18:30 +0000)]
add a test

2 years agoUse locked_version more
Jacob Finkelman [Wed, 2 Mar 2022 23:03:14 +0000 (23:03 +0000)]
Use locked_version more

2 years agoWrap an error context for determining the amount of parallelism
Weihang Lo [Wed, 2 Mar 2022 11:41:31 +0000 (19:41 +0800)]
Wrap an error context for determining the amount of parallelism

2 years agoAuto merge of #10443 - alexcrichton:disable-dependabot, r=ehuss
bors [Tue, 1 Mar 2022 20:38:55 +0000 (20:38 +0000)]
Auto merge of #10443 - alexcrichton:disable-dependabot, r=ehuss

Disable dependabot

I don't think this has ever actually sent a meaningful version bump PR
we weren't already aware of, so unless someone else wants to be in
charge of these I'm going to go ahead and disable dependabot.

2 years agoAuto merge of #10442 - Urgau:git2-update, r=alexcrichton
bors [Tue, 1 Mar 2022 18:12:20 +0000 (18:12 +0000)]
Auto merge of #10442 - Urgau:git2-update, r=alexcrichton

Update git2 dependencies

This pull-request update git2 to 0.14.1 and git2-curl to 0.15.0 and libgit2-sys to 0.13.1.

This fix a memory corruption that I have locally when running the testsuite:
```
==2338650==  Uninitialised value was created by a stack allocation
==2338650==    at 0x11FE3A0: git2::remote::Remote::fetch (remote.rs:276)
```

2 years agoDisable dependabot
Alex Crichton [Tue, 1 Mar 2022 17:53:20 +0000 (09:53 -0800)]
Disable dependabot

I don't think this has ever actually sent a meaningful version bump PR
we weren't already aware of, so unless someone else wants to be in
charge of these I'm going to go ahead and disable dependabot.

2 years agoUpdate git2 to 0.14.1 and git2-curl to 0.15.0 and libgit2-sys to 0.13.1
Loïc BRANSTETT [Tue, 1 Mar 2022 17:39:22 +0000 (18:39 +0100)]
Update git2 to 0.14.1 and git2-curl to 0.15.0 and libgit2-sys to 0.13.1

2 years agoA cry for help with a fix for the issue that looks like a hack.
Sebastian Thiel [Tue, 1 Mar 2022 07:18:14 +0000 (15:18 +0800)]
A cry for help with a fix for the issue that looks like a hack.

In order not to give up and create a basis for discussion while ending
my 3h oddisey on finding a fix for today, I present something that
seems to work even though I hope there are better ways to solve this.

2 years agominor improvement to how artifact targets are handled in platform descriptions
Sebastian Thiel [Tue, 1 Mar 2022 05:18:36 +0000 (13:18 +0800)]
minor improvement to how artifact targets are handled in platform descriptions

2 years agotrigger another failure by using [target.'cfg(…)'.dependencies] syntax
Sebastian Thiel [Tue, 1 Mar 2022 03:09:49 +0000 (11:09 +0800)]
trigger another failure by using [target.'cfg(…)'.dependencies] syntax

2 years agoA fix for the previous simplified reproduction
Sebastian Thiel [Tue, 1 Mar 2022 03:04:41 +0000 (11:04 +0800)]
A fix for the previous simplified reproduction

2 years agofurther simplify the reproduction code
Sebastian Thiel [Tue, 1 Mar 2022 02:19:10 +0000 (10:19 +0800)]
further simplify the reproduction code

This is a hacky way of making changes while leaving everything else,
despite it being deactivated for now, in the hopes to not forget
to put additional difficulties back in once this particular issue
is fixed.

2 years agoreproduce issue; this time with build dependencies
Sebastian Thiel [Tue, 1 Mar 2022 01:37:17 +0000 (09:37 +0800)]
reproduce issue; this time with build dependencies

They differ as these will be built for the host, so
`FeaturesFor` will not set a target specifically.

2 years agoRemove the update method on registry functions. Instead of explicitly
Arlo Siemsen [Wed, 23 Feb 2022 22:51:31 +0000 (14:51 -0800)]
Remove the update method on registry functions. Instead of explicitly
updating, registries now update as needed. To force a registry to
ensure the latest copy of crate metadata is available, a new method
called `invalidate_cache` is added. This method will cause the registry
to update the next time `block_until_ready` is called.

2 years agoRegistry functions return task::Poll to enable parallel fetching of index data.
Arlo Siemsen [Mon, 8 Nov 2021 21:56:44 +0000 (13:56 -0800)]
Registry functions return task::Poll to enable parallel fetching of index data.

2 years agoAuto merge of #10434 - weihanglo:stop-gating-stable-features, r=alexcrichton
bors [Mon, 28 Feb 2022 20:17:13 +0000 (20:17 +0000)]
Auto merge of #10434 - weihanglo:stop-gating-stable-features, r=alexcrichton

Stop gating stable features

2 years agoAuto merge of #10395 - jonhoo:fix-10206, r=alexcrichton
bors [Mon, 28 Feb 2022 19:29:07 +0000 (19:29 +0000)]
Auto merge of #10395 - jonhoo:fix-10206, r=alexcrichton

Enable propagating host rustflags to build scripts

### What does this PR try to resolve?

This PR primarily fixes #10206, but in doing so it also slightly modifies the interface for the unstable `target-applies-to-host` feature (#9453), and adds the unstable `target-applies-to-host-kind` flag to mirror `target-applies-to-host` for build scripts and other host artifacts.

The commit messages have more in-depth discussion.

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

The test case from #10206 now works rather than producing an error. It has also been added a regression test case. A few additional test cases have also been added to handle the expected behavior around rustflags for build scripts with and without `target-applies-to-host-kind` enabled.

### Additional information

1. This changes the interface for `target-applies-to-host` so that it does not need to be specified twice to be used. And it can still be set through configuration files using the `[unstable]` table. However, we may(?) want to pick a stable format for in-file configuration of this setting unless we intend for it to only ever be a command-line flag.
2. It may be that `target-applies-to-host-kind` is never behavior we want users to turn on, and that it should therefore simply be removed and hard-coded as being `false`.
3. It's not entirely clear how `target-applies-to-host-kind` should interact with `-Zmultitarget`. If, for example, `requested_kinds = [HostTarget, SomeOtherTarget]` and `kind.is_host()`, should `RUSTFLAGS` take effect or not? For the time being I've just hard-coded the behavior for single targets, and the answer would be "no".

2 years agoAuto merge of #10425 - epage:search, r=alexcrichton
bors [Mon, 28 Feb 2022 17:15:55 +0000 (17:15 +0000)]
Auto merge of #10425 - epage:search, r=alexcrichton

feat(search): Highlight search term

This supersedes #10116.  For the requested colored-output tests, this followed the pattern of the `fix` tests which just detects whether colored output is used or not.  The `cache_messages` actually verify the output is colored but that is because it can just compare to a rustc call's output.  Getting the colored output correct by hand in a test (with all of the resets) is a bit messy and would be brittle.

This was done in an exercise in exploring ways to generalize colored output support in preparation for `cargo-add` doing some colored output as well.

I converted all output calls to use this approach, even if coloring wasn't used, for consistency.  I considered coloring the overflow message but decided to hold off on that for now (either a warning-yellow or a hint-gray).

Fixes #9918

2 years agoStop gating feature "edition2021"
Weihang Lo [Mon, 28 Feb 2022 15:33:22 +0000 (23:33 +0800)]
Stop gating feature "edition2021"

2 years agoStop gating feature "resolver"
Weihang Lo [Mon, 28 Feb 2022 15:25:21 +0000 (23:25 +0800)]
Stop gating feature "resolver"

2 years agoStop gating feature "named-profiles"
Weihang Lo [Mon, 28 Feb 2022 15:15:21 +0000 (23:15 +0800)]
Stop gating feature "named-profiles"

2 years agoStop gating feature "profile-overrides"
Weihang Lo [Mon, 28 Feb 2022 14:59:11 +0000 (22:59 +0800)]
Stop gating feature "profile-overrides"

2 years agoStop gating feature "rename-dependency"
Weihang Lo [Mon, 28 Feb 2022 14:56:21 +0000 (22:56 +0800)]
Stop gating feature "rename-dependency"

2 years agoStop gating feature "edition"
Weihang Lo [Mon, 28 Feb 2022 14:50:45 +0000 (22:50 +0800)]
Stop gating feature "edition"

2 years agoLook at FeaturesFor:: to decide if a dependency participates in feature resolution
Sebastian Thiel [Mon, 28 Feb 2022 03:28:01 +0000 (11:28 +0800)]
Look at FeaturesFor:: to decide if a dependency participates in feature resolution

Fixes #10431.

2 years agoreproduce #10431
Sebastian Thiel [Mon, 28 Feb 2022 02:28:32 +0000 (10:28 +0800)]
reproduce #10431

2 years agoAuto merge of #10428 - Urgau:check-cfg-features-rustdoc, r=ehuss
bors [Sun, 27 Feb 2022 19:20:56 +0000 (19:20 +0000)]
Auto merge of #10428 - Urgau:check-cfg-features-rustdoc, r=ehuss

Add -Z check-cfg-features support for rustdoc

This PR is a follow to https://github.com/rust-lang/cargo/pull/10408 where support for compile-time checking of features was implemented for `rustc`.

At the time `rustdoc` support wasn't yet merged, but now that it has been [merged](https://github.com/rust-lang/rust/pull/94154), this pull-request add support for it in the `doc` and `test --doc` (doctest) mode.

r? `@alexcrichton`

2 years agoAuto merge of #10388 - weihanglo:issue-10356, r=ehuss
bors [Sun, 27 Feb 2022 18:33:14 +0000 (18:33 +0000)]
Auto merge of #10388 - weihanglo:issue-10356, r=ehuss

Override target crate-type for `cargo rustc --crate-type`

2 years agoAuto merge of #10167 - hi-rustin:rustin-patch-test, r=ehuss
bors [Sun, 27 Feb 2022 17:48:39 +0000 (17:48 +0000)]
Auto merge of #10167 - hi-rustin:rustin-patch-test, r=ehuss

Use 1.51.0 in old cargos test

Remove TODO.
If the default toolchain is the same as "stable", just skip the `avoids_split_debuginfo_collision` test.

2 years agoAuto merge of #10429 - cuviper:config-verbosity, r=ehuss
bors [Sun, 27 Feb 2022 00:25:16 +0000 (00:25 +0000)]
Auto merge of #10429 - cuviper:config-verbosity, r=ehuss

Fix term.verbose without quiet, and vice versa

The match pattern only looked for `Some(false)`, missing `None`.

2 years agoFix term.verbose without quiet, and vice versa
Josh Stone [Sat, 26 Feb 2022 22:17:00 +0000 (14:17 -0800)]
Fix term.verbose without quiet, and vice versa

The match pattern only looked for `Some(false)`, missing `None`.

2 years agoAdd -Z check-cfg-features support for rustdoc
Loïc BRANSTETT [Fri, 25 Feb 2022 14:59:39 +0000 (15:59 +0100)]
Add -Z check-cfg-features support for rustdoc

2 years agoCheck 1.60 behavior
hi-rustin [Sat, 26 Feb 2022 11:24:48 +0000 (19:24 +0800)]
Check 1.60 behavior

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2 years agoUse `available_parallelism` instead of num_cpus
Weihang Lo [Sat, 26 Feb 2022 07:47:33 +0000 (15:47 +0800)]
Use `available_parallelism` instead of num_cpus

`std::thread::available_parallelism` has been stabilized since 1.59.0.

Also, we don't want to block timing data output, so if parallelism
data is not available the table will display `ncpu=n/a` instead.

2 years agoSkip avoids_split_debuginfo_collision on stable
hi-rustin [Wed, 12 Jan 2022 09:09:13 +0000 (17:09 +0800)]
Skip avoids_split_debuginfo_collision on stable

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
Address comments

Signed-off-by: hi-rustin <rustin.liu@gmail.com>