Commit Graph

12016 Commits

Author SHA1 Message Date
Eric Huss 20017a249c Add a notice about review capacity. 2022-03-24 14:18:42 -07:00
bors cd46164480 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.
2022-03-21 21:19:23 +00:00
Eric Huss 9b5bc788f7 Update doc string for deps_of/compute_deps. 2022-03-21 12:44:21 -07:00
bors 5e09899f33 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.
2022-03-21 18:48:36 +00:00
bors 109bfbd055 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`
2022-03-17 21:43:09 +00:00
Arlo Siemsen a4a882dff1 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.
2022-03-17 11:09:07 -07:00
bors 1023fa5c1e 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()`.
2022-03-17 17:17:11 +00:00
Josh Stone 58508e2a53 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()`.
2022-03-17 09:31:59 -07:00
David Tolnay 809bcfe91d
Print only Message::Finish errors all the time 2022-03-16 00:18:52 -07:00
bors 2ac382d8e2 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.
2022-03-16 02:40:40 +00:00
bors 6b2bf4a745 Auto merge of #10479 - weihanglo:bump-git2, r=ehuss
Bump git2@0.14.2 and libgit2-sys@0.13.2
2022-03-15 03:23:58 +00:00
Weihang Lo 0e044546f8
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.
2022-03-15 07:26:45 +08:00
Sebastian Thiel 0b53b1b6d4
Undo a prior change to fix #10452 2022-03-14 11:01:28 +08:00
Sebastian Thiel 92cce52182
reproduce: wrong features in a build script for a shared dependency (#10452) 2022-03-14 10:55:30 +08:00
Sebastian Thiel 4e847a2c11
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.
2022-03-14 10:24:55 +08:00
bors b816d82ee9 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.
2022-03-12 00:24:43 +00:00
Andrew Eikum d41f5ccd7e vendor: Don't allow multiple values for --sync 2022-03-11 10:41:12 -06:00
bors f955ddc9eb 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>`.
2022-03-11 15:50:15 +00:00
Jacob Finkelman 9588f838bc dont need index in the type 2022-03-10 21:04:06 +00:00
bors 56ccd1f1c7 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.
2022-03-10 00:41:25 +00:00
Jacob Finkelman f88cd8d2cc at rest we can either have a credential process or a token 2022-03-09 23:51:35 +00:00
bors a77ed9ba87 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`
2022-03-09 19:30:19 +00:00
Jacob Finkelman 0c07056bfe cargo fmt 2022-03-09 19:27:49 +00:00
bors 19f31880cf Auto merge of #10468 - weihanglo:contrib-doc-refine, r=ehuss
Refine the contributor guide
2022-03-09 17:12:06 +00:00
hi-rustin 8b895cc80b Use warn_on_deprecated
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-10 00:08:28 +08:00
hi-rustin b295e2fd67 Warning on conflicting dev_dependencies keys of platform
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-09 23:16:38 +08:00
hi-rustin ad375afa7a Warning on conflicting build_dependencies keys of platform
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-09 23:16:38 +08:00
hi-rustin 460ea25377 Warning on conflicting default_features keys
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-09 23:16:38 +08:00
hi-rustin ed93c94bd1 Warning on conflicting build_dependencies keys
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-09 23:16:38 +08:00
hi-rustin 154f372b6b Warning on conflicting dev-dependencies keys
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-09 23:16:38 +08:00
hi-rustin a317aff9b8 Warning on conflicting crate_types keys
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-09 23:16:38 +08:00
hi-rustin 375ccd2f4a Warning on conflicting proc_macro
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-09 23:16:38 +08:00
Weihang Lo 2d06e57040
Call out the contributor guide on the readme 2022-03-09 10:33:13 +08:00
Weihang Lo 50bc1db327
Reuse "Before hacking on Cargo" to emphasize discussion before hacking 2022-03-09 10:33:13 +08:00
bors 65c8266426 Auto merge of #10438 - rukai:deny_clippy, r=ehuss
Remove remaining 2 warn(clippy::*) instances
2022-03-09 02:32:56 +00:00
Weihang Lo a927c34762
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.
2022-03-09 10:25:02 +08:00
Lucas Kent fab44ff971 Remove warn(clippy::*) 2022-03-09 10:33:39 +11:00
bors 6d11f9e7d4 Auto merge of #10427 - weihanglo:drop-num_cpus, r=joshtriplett
Use `available_parallelism` instead of `num_cpus`
2022-03-08 17:07:30 +00:00
Arlo Siemsen 6aad5eca8b Pull Request feedback 2022-03-07 12:21:04 -08:00
bors c5cdd25c14 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.
2022-03-07 16:38:27 +00:00
bors 865cd5a0c1 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
2022-03-07 16:02:18 +00:00
Jacob Finkelman 88f3bb9a67 add a test for login on stdin 2022-03-04 23:05:48 +00:00
Jacob Finkelman 7ca522ae2f Remove some dead code in SourceMap 2022-03-04 22:19:50 +00:00
bors 0a3f2b4a30 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
2022-03-04 20:54:46 +00:00
Jacob Finkelman 3e7169185a
prompt not propt
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2022-03-04 14:52:10 -05:00
bors a6c7172fa3 Auto merge of #10454 - cuishuang:master, r=ehuss
fix some typos
2022-03-04 18:38:58 +00:00
Jacob Finkelman 19229a4b19 Don't recommend leaking tokens into the console history 2022-03-04 17:25:07 +00:00
hi-rustin b68bf77840 Wait up to one second while waiting for curl
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-04 22:06:26 +08:00
cuishuang 8f26842bf2 fix some typos
Signed-off-by: cuishuang <imcusg@gmail.com>
2022-03-04 13:41:18 +08:00
bors 9cffcfc91e Auto merge of #10453 - notriddle:notriddle/vec-extend, r=weihanglo
Use `extend` instead of `push`ing in a loop
2022-03-04 01:27:18 +00:00