13338 Commits

Author SHA1 Message Date
bors
fc2242a8c5 Auto merge of #11592 - jofas:11513-fix, r=weihanglo
Corrected documentation of how to cache binaries installed with `cargo install` in CI workflows

Fix for #11513. Updated the cargo book documentation on how to cache the `$CARGO_HOME` directory in CI workflows (added that the `.crates.toml` and `.crates2.json` files must be cached alongside the `/bin` folder, if installed binaries are cached)
2023-01-18 11:07:23 +00:00
jofas
37f05101b2 explaining that and must be cached alongside binaries installed with 2023-01-18 11:44:23 +01:00
bors
a5d47a7259 Auto merge of #11583 - ehuss:container-tests, r=epage
Add network container tests

This adds some tests which use Docker containers to provide HTTPS and SSH servers. This should help with validating that Cargo's networking and security are working correctly.  It can also potentially be used in the future for other tests that require more complex setups.

These tests are only run on Linux in CI. macOS does not have Docker there, and the Windows Docker does not support Linux containers. The tests should work on macOS if you run them locally with Docker Desktop installed. The SSH tests do not work on Windows due to issues with ssh-agent, but the HTTPS tests should work with Docker Desktop.

These tests require an opt-in environment variable to run:

* `CARGO_PUBLIC_NETWORK_TESTS=1` — This is for tests that contact the public internet.
* `CARGO_CONTAINER_TESTS=1` — This is for tests that use Docker.
2023-01-16 18:51:50 +00:00
bors
2a5ff4cb9a Auto merge of #11579 - kawaemon:show-progress-on-git-cli-fetch, r=weihanglo
Show progress of crates.io index update even `net.git-fetch-with-cli` option enabled

### What does this PR try to resolve?

This PR fixes #11574 .

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

Please run `cargo` with `net.git-fetch-with-cli` option enabled.
It should show `git fetch`'s progress output like below.
```
❯ CARGO_NET_GIT_FETCH_WITH_CLI=true ./target/debug/cargo b
    Updating crates.io index
remote: Enumerating objects: 139821, done.
remote: Counting objects: 100% (2226/2226), done.
remote: Compressing objects: 100% (769/769), done.
receiving objects:   0% (1/139821)
```
2023-01-16 16:51:02 +00:00
bors
f0b6f81a78 Auto merge of #11550 - weihanglo:issue-10607, r=ehuss
`cargo metadata` supports artifact dependencies
2023-01-16 16:05:29 +00:00
bors
8eb9a0cdfa Auto merge of #11504 - strager:fix-profile-doc, r=weihanglo
fix(docs): add required "inherits" option to example profile

## What does this PR try to resolve?

I copy-pasted then modified the example [profile.<name>] section in Cargo's docs. I was met with the following error:

> error: profile quick-build-incremental is missing an inherits directive (inherits is required for all profiles except dev or release)

## How should we test and review this PR?

Copy-paste the new docs into a `Cargo.toml` file, tweak, then try to use the new profile (`cargo build --profile mynewprofile`).

## Additional information

None
2023-01-16 15:04:46 +00:00
Weihang Lo
d02e36cea1
Only output field extern_name when using -Zbindeps 2023-01-16 14:12:32 +00:00
Weihang Lo
690e6a4128
cargo-metadata: error out if same dep with differnt names
Previous, `cargo metadata` allows a dependency with different renamed
co-exist. However, its `resolve.nodes.deps` will miss that dependency,
which is wrong. After this commit, `cargo metadata starts erroring out
for that situation.
2023-01-16 14:12:32 +00:00
Weihang Lo
272193aa29
cargo-metadata: error out when encountering invalid artifact kind syntax
This refactor reuse the logic of
`core::compiler::unit_dependencies::match_artifacts_kind_with_targets`
to emit error if there is any syntax error in `ArtifactKind`.

It also put `match_artifacts_kind_with_targets` to a better place `core::compiler::artifact`.
2023-01-16 14:12:13 +00:00
Weihang Lo
e5ec492b6f
cargo-metadata: support -Zbindeps info 2023-01-16 14:12:13 +00:00
bors
8681a5a0ca Auto merge of #11586 - hds:ssh-known-hosts-doc-update, r=weihanglo
add documentation that SSH markers aren't supported

### What does this PR try to resolve?

Cargo doesn't support the ``@cert-authority`` or ``@revoked`` markers in SSH
Known Hosts files. The lines are silently ignored.

If a user is depending on these lines to connect to a Git server via
SSH, then their command line Git client will work, but Cargo will fail
with an error that the host key doesn't match.

This change adds a note explaining that Cargo doesn't support these
markers and suggests that the user change their cargo configuration to
fetch with the CLI client instead.

This PR fixes the first part (of 4) of the suggested tasks to fix #11577.

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

This change only modifies the Cargo book source. Running `mdbook build`
and checking the SSH Known Hosts section of the appendix on Git
authentication should be sufficient to test the PR.

### Additional information

The note in this section repeats what is said in the higher section on
SSH authentication, however given the recently implemented host key
checking, it seems worth calling out the limitation that Cargo doesn't
support these markers in the SSH known hosts file explicitly. Hopefully,
it reduces support requests and questions as well.
2023-01-16 14:00:46 +00:00
Weihang Lo
ca626c5915
refactor: reuse crate type strings in ArtifactKind 2023-01-16 13:57:27 +00:00
Hayden Stainsby
f460ac2b1d add documentation that SSH markers aren't supported
Cargo doesn't support the `@cert-authority` or `@revoked` markers in SSH
Known Hosts files. The lines are silently ignored.

If a user is depending on these lines to connect to a Git server via
SSH, then their command line Git client will work, but Cargo will fail
with an error that the host key doesn't match.

This change adds a note explaining that Cargo doesn't support these
markers and suggests that the user change their cargo configuration to
fetch with the CLI client instead.

Refs: #11577
2023-01-16 14:22:25 +01:00
bors
7b4737f1c4 Auto merge of #11585 - hi-rustin:rustin-patch-typo, r=ehuss
Fix typo
2023-01-16 02:58:54 +00:00
hi-rustin
7be22aae95 Move TODO to the right place
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-01-16 10:22:16 +08:00
hi-rustin
28c134c570 Fix typo
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-01-16 09:57:17 +08:00
Matthew "strager" Glazar
80bc392e42 fix(docs): add required "inherits" option to example profile 2023-01-15 17:12:17 -08:00
Eric Huss
4cb9ac35bf Add network container tests 2023-01-14 15:10:16 -08:00
bors
88f14290f2 Auto merge of #11582 - ehuss:enable-source_config_env, r=weihanglo
Enable source_config_env test on Windows

This enables the `advaned_env::source_config_env` test on Windows. The issue with `Command` modifying the case of environment variables was fixed by https://github.com/rust-lang/rust/pull/85270.
2023-01-14 19:02:16 +00:00
Eric Huss
73f19a01d0 Enable source_config_env test on Windows 2023-01-14 09:48:46 -08:00
kawaemon
5bd8ef62e0
update test snapshot 2023-01-15 00:18:12 +09:00
kawaemon
462d3ab3e3
stop capturing git's output 2023-01-14 23:38:49 +09:00
kawaemon
badc18f098
let git to respect cargo's verbosity 2023-01-14 23:36:38 +09:00
bors
48e0c530d4 Auto merge of #11562 - weihanglo:issue-11552, r=ehuss
Support `codegen-backend` and `rustflags` in profiles in config file
2023-01-14 13:53:29 +00:00
Weihang Lo
5c87110184
doc(unstable): add codegen-backend to the list of unstable features 2023-01-14 11:14:41 +00:00
Weihang Lo
e6011b0863
doc(unstable): profile-rustflags and codegen-backend in config.toml 2023-01-14 11:14:41 +00:00
Weihang Lo
629f763be8
Support codegen-backend and rustflags in profiles in config file 2023-01-14 11:14:40 +00:00
bors
98645f1b9a Auto merge of #11578 - weihanglo:ci-fix, r=epage
ci: reflect to clap updates
2023-01-14 10:23:05 +00:00
Weihang Lo
c51c6bb6ac
chore: reflect to clap updates 2023-01-14 09:23:39 +00:00
bors
1cd6d3803d Auto merge of #11568 - jofas:fix_for_11555, r=weihanglo
Fix for #11555

Fix for #11555. I more or less blindly followed the instructions given by `@weihanglo` in the description of the issue:

1. I replaced every link from `doc.crates.io/contrib/apidoc/cargo` with `doc.rust-lang.org/nightly/nightly-rustc/cargo`
2. Added redirection rule to `src/doc/contrib/book.toml` that should redirect the `/apidoc/cargo/` endpoint to `https://doc.rust-lang.org/nightly/nightly-rustc/cargo`
3. Reverted the changes made to the CI workflow in ba3d2e981b and 1c82d9c8c3 (building the api docs as part of the contribution guide)
2023-01-12 18:40:36 +00:00
Jonas Fassbender
9fec8d6377
Update src/doc/contrib/book.toml
Co-authored-by: Weihang Lo <weihanglo@users.noreply.github.com>
2023-01-12 19:13:53 +01:00
jofas
7bd86d207c removed steps for api doc creation from action 2023-01-12 14:03:30 +01:00
jofas
e9f599a8fc redirect contrib/apidoc/cargo/ to new hosting location of cargo api docs 2023-01-12 13:58:45 +01:00
jofas
ab30710e71 replaced all occurences of doc.crates.io/contrib/apidoc/cargo with doc.rust-lang.org/nightly/nightly-rustc/cargo 2023-01-12 12:19:42 +01:00
bors
abc6abe34d Auto merge of #11561 - epage:typos, r=ehuss
chore: Fix typos

Seeing several typo PRs, like #11560, I figured I'd run my source code spell checker on cargo to help catch a lot of these earlier, in one big batch.
2023-01-11 14:15:24 +00:00
Ed Page
ed8b85f10e chore: Fix typos 2023-01-10 20:03:11 -06:00
bors
65a0a89482 Auto merge of #11560 - RagnarGrootKoerkamp:master, r=weihanglo
fix(docs): fix typo learm => learn in cargo tree docs

Fix a typo in the `cargo tree` docs.
2023-01-11 01:57:06 +00:00
Ragnar Groot Koerkamp
ac855aad08 fix(docs): fix typo learm => learn in cargo tree docs 2023-01-11 02:11:36 +01:00
bors
0849a28cc2 Auto merge of #11556 - pietroalbini:cve-2022-46176, r=weihanglo
Add fix for CVE-2022-46176

r? `@ehuss`
2023-01-10 17:26:08 +00:00
Eric Huss
d992ab4e90
known_hosts: Switch the documentation to stable.
When making the stable release, the nightly docs won't be updated, yet.
This makes sure that the link will work for the stable release.
2023-01-10 14:36:41 +01:00
Eric Huss
23c547166c
update changelog. 2023-01-10 14:36:40 +01:00
Eric Huss
67ae2dcafe
ssh known_hosts: support hashed hostnames 2023-01-10 14:36:39 +01:00
Eric Huss
018403ceaf
Add test for config Value in TOML array. 2023-01-10 14:36:37 +01:00
Eric Huss
cf716fc3c2
Remove let-else, just use ? propagation.
Co-authored-by: Weihang Lo <weihanglo@users.noreply.github.com>
2023-01-10 14:36:36 +01:00
Eric Huss
302a543ddf
Add some known_hosts tests.
This also fixes a bug with the host matching when there are comma-separated hosts.
2023-01-10 14:36:34 +01:00
Eric Huss
026bda3fb5
Support configuring ssh known-hosts via cargo config. 2023-01-10 14:36:33 +01:00
Eric Huss
9f62f8440e
Add support for deserializing Vec<Value<String>> in config.
This adds the ability to track the definition location of a string
in a TOML array.
2023-01-10 14:36:31 +01:00
Eric Huss
1387fd4105
Validate SSH host keys 2023-01-10 14:36:22 +01:00
bors
247b22f225 Auto merge of #11541 - ehuss:fix-dep-unwrap, r=epage
Fix panic on target dependency errors.

Errors while processing a target dependency would cause a panic due to some calls to `unwrap` in the TOML processing code. Those unwraps should not be there, and it should just propagate the errors upwards just  like is done for normal dependencies.

Fixes #11540
2023-01-05 02:52:35 +00:00
Eric Huss
fab135885c Fix panic on ignored target dependency. 2023-01-04 18:44:51 -08:00