Commit graph

11993 commits

Author SHA1 Message Date
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
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
Michael Howell
d8c08223fc Use extend instead of pushing in a loop 2022-03-03 16:33:49 -07:00
bors
72873d8e50 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
2022-03-03 20:20:13 +00:00
Jacob Finkelman
4164c46a1b add a test 2022-03-03 18:49:52 +00:00
Jacob Finkelman
15c7c0847a Use locked_version more 2022-03-03 16:56:30 +00:00
Weihang Lo
4f706ae8d5
Wrap an error context for determining the amount of parallelism 2022-03-02 19:41:31 +08:00
bors
5f611afe28 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.
2022-03-01 20:38:55 +00:00
bors
e756c130cf 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)
```
2022-03-01 18:12:20 +00:00
Alex Crichton
959fcbc188 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.
2022-03-01 09:53:20 -08:00
Loïc BRANSTETT
dd701a17f3 Update git2 to 0.14.1 and git2-curl to 0.15.0 and libgit2-sys to 0.13.1 2022-03-01 18:39:22 +01:00
Arlo Siemsen
f12f0256ca 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.
2022-02-28 14:36:08 -06:00
Arlo Siemsen
82093ad9dc Registry functions return task::Poll to enable parallel fetching of index data. 2022-02-28 12:22:11 -08:00
bors
489b66f2e4 Auto merge of #10434 - weihanglo:stop-gating-stable-features, r=alexcrichton
Stop gating stable features
2022-02-28 20:17:13 +00:00
bors
3d6970d50e 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".
2022-02-28 19:29:07 +00:00
bors
9d754ed085 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
2022-02-28 17:15:55 +00:00