]> git.proxmox.com Git - cargo.git/log
cargo.git
20 months agobump version to 0.63.0-1~exp1~bpo11+pve2
Fabian Grünbichler [Thu, 15 Sep 2022 07:38:49 +0000 (09:38 +0200)]
bump version to 0.63.0-1~exp1~bpo11+pve2

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
20 months agofix CVE-2022-36113/CVE-2022-36114
Fabian Grünbichler [Thu, 15 Sep 2022 07:38:02 +0000 (09:38 +0200)]
fix CVE-2022-36113/CVE-2022-36114

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
21 months agobump version to 0.63.0-1~exp1~bpo11+pve1
Fabian Grünbichler [Fri, 5 Aug 2022 11:47:12 +0000 (13:47 +0200)]
bump version to 0.63.0-1~exp1~bpo11+pve1

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
21 months agoMerge branch 'mr/0.63' into proxmox/bullseye
Fabian Grünbichler [Fri, 5 Aug 2022 11:47:03 +0000 (13:47 +0200)]
Merge branch 'mr/0.63' into proxmox/bullseye

21 months agobump version to 0.63.0-1~exp1
Fabian Grünbichler [Tue, 19 Jul 2022 08:20:55 +0000 (10:20 +0200)]
bump version to 0.63.0-1~exp1

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
21 months agod/control: bump libgit2 to 1.4
Fabian Grünbichler [Tue, 19 Jul 2022 08:36:46 +0000 (10:36 +0200)]
d/control: bump libgit2 to 1.4

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
21 months agodrop patches
Fabian Grünbichler [Tue, 19 Jul 2022 08:32:29 +0000 (10:32 +0200)]
drop patches

these were either applied upstream, fixed otherwise upstream, or applied
via debcargo-conf already.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
21 months agoUpdate upstream source from tag 'upstream/0.63.0'
Fabian Grünbichler [Tue, 19 Jul 2022 11:48:32 +0000 (13:48 +0200)]
Update upstream source from tag 'upstream/0.63.0'

Update to upstream version '0.63.0'
with Debian dir 57bd1022b7f840a321d436fbbdd373284d09ad52

21 months agoNew upstream version 0.63.0
Fabian Grünbichler [Tue, 19 Jul 2022 11:47:57 +0000 (13:47 +0200)]
New upstream version 0.63.0

21 months agoopenssl
Fabian Grünbichler [Tue, 19 Jul 2022 09:55:05 +0000 (11:55 +0200)]
openssl

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
21 months agoupdate unsuspicious files
Fabian Grünbichler [Tue, 19 Jul 2022 07:04:09 +0000 (09:04 +0200)]
update unsuspicious files

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
21 months agopin some versions to match debcargo-conf
Fabian Grünbichler [Tue, 19 Jul 2022 07:03:46 +0000 (09:03 +0200)]
pin some versions to match debcargo-conf

to reduce patching noise

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
21 months agoupdate debcargo-conf.patch
Fabian Grünbichler [Tue, 19 Jul 2022 07:02:26 +0000 (09:02 +0200)]
update debcargo-conf.patch

additionally, the following diff needs to be applied in debcargo-conf
directly to work around the limitations of our vendoring script:

diff --git a/src/tempfile/debian/patches/relax-dep.diff b/src/tempfile/debian/patches/relax-dep.diff
deleted file mode 100644
index bec6f1d81..000000000
--- a/src/tempfile/debian/patches/relax-dep.diff
+++ /dev/null
@@ -1,13 +0,0 @@
-Index: tempfile/Cargo.toml
-===================================================================
---- tempfile.orig/Cargo.toml
-+++ tempfile/Cargo.toml
-@@ -28,7 +28,7 @@ version = "1"
- version = "1.6.0"
-
- [dependencies.remove_dir_all]
--version = "0.5"
-+version = "0.7"
- [dev-dependencies.doc-comment]
- version = "0.3"
-
diff --git a/src/tempfile/debian/patches/series b/src/tempfile/debian/patches/series
deleted file mode 100644
index 75abb7f14..000000000
--- a/src/tempfile/debian/patches/series
+++ /dev/null
@@ -1 +0,0 @@
-relax-dep.diff

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
21 months agod/make_orig_multi: don't use legacy GZIP env var
Fabian Grünbichler [Thu, 6 May 2021 08:27:48 +0000 (10:27 +0200)]
d/make_orig_multi: don't use legacy GZIP env var

pass gzip commandline directly to tar instead.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
21 months agoguesst-crate-copyright: handle missing authors
Fabian Grünbichler [Tue, 19 Jul 2022 07:18:22 +0000 (09:18 +0200)]
guesst-crate-copyright: handle missing authors

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
21 months agoaudit-vendor-source: support filesystems with small dirs
Fabian Grünbichler [Tue, 19 Jul 2022 07:17:29 +0000 (09:17 +0200)]
audit-vendor-source: support filesystems with small dirs

like ZFS, where the tests also match (some) directories with contents,
which fail to delete and are quite noisy.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
22 months agodocument that cargo lock is mandatory for the repack
Sylvestre Ledru [Sun, 19 Jun 2022 09:01:38 +0000 (11:01 +0200)]
document that cargo lock is mandatory for the repack

23 months agoAuto merge of #10737 - ehuss:revert-num-cpus, r=weihanglo
bors [Wed, 8 Jun 2022 23:13:47 +0000 (23:13 +0000)]
Auto merge of #10737 - ehuss:revert-num-cpus, r=weihanglo

[beta] Revert #10427: switch from num_cpus

This temporarily reverts #10427 (Use available_parallelism instead of num_cpus) per the discussion at https://github.com/rust-lang/rust/issues/97549. `available_parallelism` does not handle cgroups v1 on Linux unlike num_cpus. I am concerned that this potentially affects a significant percentage of users. For example, Docker just added cgroups v2 support last year. Various Linux distributions have only recently switched to it as the default. The following is what I can find on the web:

* Fedora (since 31)
* Arch Linux (since April 2021)
* openSUSE Tumbleweed (since c. 2021)
* Debian GNU/Linux (since 11)
* Ubuntu (since 21.10)
* RHEL and RHEL-like distributions (since 9)

This also appears to affect CircleCI.

The consequence is that Cargo ends up using too much parallelism and can run out of memory.

I'm not sure what to do about 1.63.  If std adds support for cgroups v1, then I don't think there is anything to do there. Otherwise I think we should revert similarly if that doesn't happen.

23 months ago[beta] Revert #10427: switch from num_cpus
Eric Huss [Wed, 8 Jun 2022 21:00:26 +0000 (14:00 -0700)]
[beta] Revert #10427: switch from num_cpus

This reverts commit 6d11f9e7d4e8694b7a6a8465ec679ad422957078, reversing
changes made to c5cdd25c14ca7bd3f1691ed59535adb4f6b2c8df.

23 months agoAuto merge of #10707 - ehuss:beta-backport, r=weihanglo
bors [Fri, 27 May 2022 05:40:53 +0000 (05:40 +0000)]
Auto merge of #10707 - ehuss:beta-backport, r=weihanglo

[beta] Backport `cargo publish` fixes

Beta backport of #10677.

I think it is a serious regression where `cargo publish` may publish the wrong package in some circumstances. I think it warrants a beta backport to get the fix out asap.

23 months agoAuto merge of #10677 - likzn:fix_publish_p, r=ehuss
bors [Fri, 27 May 2022 00:43:33 +0000 (00:43 +0000)]
Auto merge of #10677 - likzn:fix_publish_p, r=ehuss

fix(publish): add more check when use `publish -p <SPEC>`

### Main issue
As issue say #10536 , we need add more check when user use `cargo publish -p <SPEC>`

>`@ehuss` point outs:
>From a behavior standpoint, here are some things to check:
> - In the root of a virtual workspace, it should be an error to run without -p.
>- It should be an error to pass -p for a non-workspace member.
>- It should be an error for -p to match multiple packages.
>- When using -p, it should publish that package, not the one in the current directory (which can be different).

2 years agoAuto merge of #10659 - Muscraft:prestabilization-inheritance-docs, r=epage
bors [Thu, 12 May 2022 15:19:04 +0000 (15:19 +0000)]
Auto merge of #10659 - Muscraft:prestabilization-inheritance-docs, r=epage

pre-stabilization documentation for workspace inheritance

This is adding documentation for how we would like users to test workspace inheritance.

This came about from a discussion between `@epage` and I on better ways to document "pre-stabilization" features that are looking for people to test them. One of the ideas was to add some of the documentation to `unstable.md` so that it is all in one area. Having it in one area allows us to link to it so there are testing notes and documentation in one place. It also helps when posting in various places looking for testers as we can link to the nightly docs as needed. One idea was to post in TWiR [under a new table](https://github.com/rust-lang/this-week-in-rust/issues/3236) and this also helps with this.

The new documentation covers
- What we are looking for from testers
- Where to give feedback
- How to test this feature
- An example port as a guide

r? `@epage`

2 years agopre-stabilization documentation for workspace inheritance
Scott Schafer [Thu, 12 May 2022 15:13:20 +0000 (10:13 -0500)]
pre-stabilization documentation for workspace inheritance

2 years agoAuto merge of #10658 - epage:fix, r=ehuss
bors [Thu, 12 May 2022 14:00:45 +0000 (14:00 +0000)]
Auto merge of #10658 - epage:fix, r=ehuss

test: Make curr_dir work in/out of workspace

### What does this PR try to resolve?

Get snapbox tests passing when testing `cargo` as part of the `rust-lang/rust` workspace via a git submodule.
- When running tests in the `rust-lang/cargo` repo, `file!` is relative to
the crate root and tests are run relative to the crate root and
everything is fine.
- When running tests in the `rust-lang/rust` repo, `file!` is relative to
the workspace root and tests are run relative to the crate root and
there is much sadness.

If we are compiling relative to the crate root, we could make the path
absolute and everything would be dandy but this needs to happen at
compile time.  Didn't see a way to do this.

We could stop using `curr_dir` but that makes the tests a bit noisier
with more overhead for creating a new tests from an existing case.

Since we can reasonly know what all roots will be used for `file!`, we
can just hard code-in support for those two roots.  Much happiness
ensues as everything works with this surgical hack.

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

I ran the tests in both the `cargo` and `rust` repos.  You can as well.

### Additional information

2 years agotest: Make curr_dir work in/out of workspace
Ed Page [Wed, 11 May 2022 15:30:41 +0000 (10:30 -0500)]
test: Make curr_dir work in/out of workspace

When running tests in the `rust-lang/cargo` repo, `file!` is relative to
the crate root and tests are run relative to the crate root and
everything is fine.

When running tests in the `rust-lang/rust` repo, `file!` is relative to
the workspace root and tests are run relative to the crate root and
there is much sadness.

If we are compiling relative to the crate root, we could make the path
absolute and everything would be dandy but this needs to happen at
compile time.  Didn't see a way to do this.

We could stop using `curr_dir` but that makes the tests a bit noisier
with more overhead for creating a new tests from an existing case.

Since we can reasonly know what all roots will be used for `file!`, we
can just hard code-in support for those two roots.  Much happiness
ensues as everything works with this surgical hack.

2 years agoAuto merge of #10660 - ehuss:fix-no_cross_doctests-race, r=weihanglo
bors [Wed, 11 May 2022 23:10:18 +0000 (23:10 +0000)]
Auto merge of #10660 - ehuss:fix-no_cross_doctests-race, r=weihanglo

Fix no_cross_doctests race condition.

The change in #10594 to the `no_cross_doctests` test introduced a race condition. The two `rustc` invocations happen concurrently, which means the order is not deterministic. This adds`_unordered` along with differentiating text to fix the issue.

2 years agoAuto merge of #10657 - hi-rustin:rustin-patch-docs-typo, r=weihanglo
bors [Wed, 11 May 2022 21:15:09 +0000 (21:15 +0000)]
Auto merge of #10657 - hi-rustin:rustin-patch-docs-typo, r=weihanglo

Fix typo

See: https://github.com/rust-lang/cargo/pull/10633#discussion_r870130957

r? `@epage`

2 years agoFix no_cross_doctests race condition.
Eric Huss [Wed, 11 May 2022 21:10:49 +0000 (14:10 -0700)]
Fix no_cross_doctests race condition.

2 years agoFix typo
hi-rustin [Wed, 11 May 2022 13:08:04 +0000 (21:08 +0800)]
Fix typo

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2 years agoAuto merge of #10650 - epage:install, r=ehuss
bors [Wed, 11 May 2022 03:25:36 +0000 (03:25 +0000)]
Auto merge of #10650 - epage:install, r=ehuss

feat(install): Support `foo@version` like cargo-add

### What does this PR try to resolve?

This aims to make `cargo install` consistent with
- `cargo add foo@version` from #10472
- pkgid changes in #10582
- `cargo yank foo@version` from #10597

It also offers a shorthand for people installing a specific version.

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

#10582 acted as the FCP for this, see #10597

Documentation updates are split into their own commit to not clog up browsing the code.

Examine the tests to see if they make sense

### Additional information

While the `foo@vewrsion` syntax is the same, each's semantics are different.  We had decided it was better to have the same syntax with different semantics than having the user worry about what syntax they use where.  In `cargo install`s case, it has an
implicit-but-required `=` operand while `cargo-add` allows any operand.

This doesn't use the full `pkgid` syntax because that allows syntax that
is unsupported here.

This doesn't use `cargo-add`s parser because that is for version reqs.

I held off on reusing the parser from `cargo-yank` because they had
different type system needs and the level of duplication didn't seem
worth it (see Rule of Three).

2 years agoAuto merge of #10649 - Muscraft:fix-typos, r=epage
bors [Tue, 10 May 2022 23:58:15 +0000 (23:58 +0000)]
Auto merge of #10649 - Muscraft:fix-typos, r=epage

fix typos found by the `typos-cli` crate

This fixes various typos inside `cargo`. They were found by [`typos-cli`](https://crates.io/crates/typos-cli). A few different typos were left out as they seemed either intentional or were needed. Typos found in `LICENSE-THIRD-PARTY` were left alone as well.

r? `@epage`

2 years agoAuto merge of #10597 - epage:yank, r=ehuss
bors [Tue, 10 May 2022 21:53:54 +0000 (21:53 +0000)]
Auto merge of #10597 - epage:yank, r=ehuss

feat(yank): Support foo@version like cargo-add

### What does this PR try to resolve?

In #10472, cargo-add was merged with support for an inline version
syntax of `cargo add foo@version`.  That also served as the change proposal for
extending that syntax to `cargo yank` for convenience and consistency.

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

Documentation updates are split into their own commit to not clog up browsing the code.

The ops API is generic enough that this is implemented purely in the command.

For now, the `foo@version` syntax parser is being left in the command, rather than being shared, as we see how the behavior of these different parsers diverge for their target needs to see what makes sense for refactoring.  See also The Rule of Three
- This doesn't use the full `pkgid` syntax (modified in #10582) because that allows syntax that is unsupported here.
- This doesn't use `cargo-add`s parser because that is for version reqs.

Tests were added for various combinations of flags and behavior.

### Additional information

The major difference is that `cargo-add` is specifying a version-req
while `cargo-yank` is specifying a version.  This was originally discussed on [zulip](https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/Multiple.20ways.20of.20specifying.20versions) and there seemed to be a desire to have one syntax rather than the user thinking about a syntax per type of version (which users won't always think about).  See also #10582 which extended the pkgid spec syntax and has some more discussion on this general trend.

`cargo-install` will be updated in a subsequent PR.

2 years agofix typos found by the `typos-cli` crate
Scott Schafer [Tue, 10 May 2022 21:47:28 +0000 (16:47 -0500)]
fix typos found by the `typos-cli` crate

2 years agoAuto merge of #10648 - Muscraft:update-workspace-inheritance-docs, r=epage
bors [Tue, 10 May 2022 19:34:45 +0000 (19:34 +0000)]
Auto merge of #10648 - Muscraft:update-workspace-inheritance-docs, r=epage

add `cargo-features` to unstable docs for workspace inheritance

The unstable docs for workspace inheritance did not include `cargo-features = ["workspace-inheritance"]`. If a user were to follow the docs cargo would throw an error saying to `feature `workspace-inheritance` is required`. It would be better to explicitly add this to the unstable docs and remove it during stabilization.

r? `@epage`

2 years agoadd `cargo-features` to unstable docs for workspace inheritance
Scott Schafer [Tue, 10 May 2022 19:27:47 +0000 (14:27 -0500)]
add `cargo-features` to unstable docs for workspace inheritance

2 years agoAuto merge of #10646 - koic:use_rust_2021_prelude, r=epage
bors [Tue, 10 May 2022 16:48:05 +0000 (16:48 +0000)]
Auto merge of #10646 - koic:use_rust_2021_prelude, r=epage

Use the traits added to the Rust 2021 Edition prelude

Follow up https://github.com/rust-lang/rust/pull/96861.

This PR uses the traits added to the Rust 2021 Edition prelude.

> The `TryInto`, `TryFrom` and `FromIterator` traits are now part of the prelude.

https://doc.rust-lang.org/edition-guide/rust-2021/prelude.html

2 years agoAuto merge of #10594 - weihanglo:issue-10560, r=ehuss
bors [Tue, 10 May 2022 15:56:03 +0000 (15:56 +0000)]
Auto merge of #10594 - weihanglo:issue-10560, r=ehuss

Pass `--target` to `rustdoc` for `cargo test` if specified with host target.

2 years agoUse the traits added to the Rust 2021 Edition prelude
Koichi ITO [Tue, 10 May 2022 12:46:45 +0000 (21:46 +0900)]
Use the traits added to the Rust 2021 Edition prelude

Follow up https://github.com/rust-lang/rust/pull/96861.

This PR uses the traits added to the Rust 2021 Edition prelude.

> The `TryInto`, `TryFrom` and `FromIterator` traits are now part of the prelude.

https://doc.rust-lang.org/edition-guide/rust-2021/prelude.html

2 years agotest: pass `--target` to `rustdoc` even if specified with host target
Weihang Lo [Tue, 10 May 2022 08:55:55 +0000 (16:55 +0800)]
test: pass `--target` to `rustdoc` even if specified with host target

2 years agoPass --target down to rustdoc if specified with host target
Weihang Lo [Sat, 23 Apr 2022 02:18:19 +0000 (10:18 +0800)]
Pass --target down to rustdoc if specified with host target

2 years agoAuto merge of #10281 - Gnurfos:depinfo_relative, r=ehuss
bors [Sat, 7 May 2022 19:49:54 +0000 (19:49 +0000)]
Auto merge of #10281 - Gnurfos:depinfo_relative, r=ehuss

Fix use of .. in dep-info-basedir

### Summary

This allows setting, in .cargo/config's dep-info-basedir, some relative path that goes above the crate's directory.

### Motivation

In a setup like this:

```
repo_root
├── Makefile
├── some_c_things
│   └── foo.c
└── rust_things
    ├── Cargo.toml
    └─── src
        └── lib.rs
```

If you want the generated .d files to be includable directly in the Makefile (without post-processing), you need them to mention paths relative to the root, like:

rust_things/target/....: rust_things/src/lib.rs

### Implementation

For this you need to have relative paths with parent directories (in this case ..) in dep-info-basedir, which does not work without the change in this PR (due to render_filename doing only strip_prefix, while the basedir still contains literal ..s).

Let me know if this change is acceptable. Another implementation could be to canonicalize in ConfigRelativePath::resolve_path instead, especially since that struct outputs absolute paths. But that would have it access the filesystem, while it currently doesn't.

2 years agoAuto merge of #10639 - catandcoder:master, r=ehuss
bors [Sat, 7 May 2022 17:54:05 +0000 (17:54 +0000)]
Auto merge of #10639 - catandcoder:master, r=ehuss

fix some typos

2 years agofix some typos
cuishuang [Sat, 7 May 2022 17:07:28 +0000 (01:07 +0800)]
fix some typos

Signed-off-by: cuishuang <imcusg@gmail.com>
2 years agoAuto merge of #10638 - Muscraft:move-snapshot-tests, r=epage
bors [Sat, 7 May 2022 02:14:00 +0000 (02:14 +0000)]
Auto merge of #10638 - Muscraft:move-snapshot-tests, r=epage

Move snapshot tests into testsuite

This moves all tests from the `snapshot` folder into the `testsuite` folder as described by [this comment](https://github.com/rust-lang/cargo/pull/10631#discussion_r866306441). A macro was also added so there is no need to specify the path in a `snapshot` test just the file. This was done for ease of refactoring and ease of porting new tests to `snapshot`

close #10627

r? `@epage`

2 years agomove all `snapshot/init/` tests to `testsuite/init/`
Scott Schafer [Sat, 7 May 2022 01:51:49 +0000 (20:51 -0500)]
move all `snapshot/init/` tests to `testsuite/init/`

2 years agomove all `snapshot/cargo_add/` tests to `testsuite/cargo_add/`
Scott Schafer [Sat, 7 May 2022 01:51:29 +0000 (20:51 -0500)]
move all `snapshot/cargo_add/` tests to `testsuite/cargo_add/`

2 years agoAuto merge of #10566 - Urgau:check-cfg-improvements, r=ehuss
bors [Fri, 6 May 2022 22:39:02 +0000 (22:39 +0000)]
Auto merge of #10566 - Urgau:check-cfg-improvements, r=ehuss

Improve support of condition compilation checking

This PR is a series of improvements to the check-cfg implementation.

### What does this PR try to resolve?

This PR resolve the concern expressed in https://github.com/rust-lang/cargo/pull/10486#issuecomment-1096842314 that is:
 * Fixing the tests on Windows: https://github.com/rust-lang/cargo/pull/10566/commits/e8aa51d8de1517f9eb3c0a4b8dab7075f7f67b2c
 * Merging all the -Z flags under -Zcheck-cfg: https://github.com/rust-lang/cargo/commit/969e282b8f843ed3cec975b4d39e9e65e0802d3b
 * Moving of all of the check-cfg tests into a separate module: https://github.com/rust-lang/cargo/commit/c18b442b30e7cf7c5d24cde8464983d3dee18267
 * And removing of an unused parameter: https://github.com/rust-lang/cargo/commit/068bdf4c064a9a6ab28015c785474c423714c7a6

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

This PR should be reviewed commit by commit and tested with the automated tests or examples.

### Additional information

I decided to use a custom macro to make the test functional under Windows, the macro generate a contains line with the correct escaping depending on the platform (windows or not windows).

2 years agoRemove now unused context arg
Loïc BRANSTETT [Thu, 14 Apr 2022 12:18:13 +0000 (14:18 +0200)]
Remove now unused context arg

2 years agoRe-enable check-cfg tests under windows with a custom macro for escaping
Loïc BRANSTETT [Thu, 14 Apr 2022 12:16:35 +0000 (14:16 +0200)]
Re-enable check-cfg tests under windows with a custom macro for escaping

2 years agoMove check cfg tests to their own module
Loïc BRANSTETT [Thu, 14 Apr 2022 10:20:36 +0000 (12:20 +0200)]
Move check cfg tests to their own module

2 years agoConvert the testsuite to use the new -Zcheck-cfg flag and syntax
Loïc BRANSTETT [Tue, 12 Apr 2022 17:46:47 +0000 (19:46 +0200)]
Convert the testsuite to use the new -Zcheck-cfg flag and syntax

2 years agoMerge of unstable check-cfg cargo flags into -Zcheck-cfg
Loïc BRANSTETT [Tue, 12 Apr 2022 17:44:13 +0000 (19:44 +0200)]
Merge of unstable check-cfg cargo flags into -Zcheck-cfg

2 years agoAuto merge of #10142 - jyn514:bin-private-link, r=ehuss
bors [Fri, 6 May 2022 19:48:59 +0000 (19:48 +0000)]
Auto merge of #10142 - jyn514:bin-private-link, r=ehuss

When documenting private items in a binary, ignore warnings about links to private items

Previously, rustdoc would warn about linking to private items in a binary, even
though cargo unconditionally documents private items in a binary.
This changes cargo to silence the warning, since it's only relevant in
cases where the private items might not be documented.

Fixes https://github.com/rust-lang/rust/issues/89600.

2 years agoAuto merge of #10582 - epage:pkgid, r=ehuss
bors [Fri, 6 May 2022 19:07:07 +0000 (19:07 +0000)]
Auto merge of #10582 - epage:pkgid, r=ehuss

Extend pkgid syntax with `@` support

In addition to `foo:1.2.3`, we now support `foo@1.2.3` for pkgids.  We
are also making it the default way of rendering pkgid's for the user.

### What does this PR try to resolve?

With cargo-add in #10472, we've decided to only use ``@`` in it and to add
it as an alternative to `:` in the rest of cargo.  `cargo-add`
originally used ``@`.`  When preparing it for merge, I switched to `:` to
be consistent with pkgids. When discussing this, it was felt ``@`` has
precedence in too many tools to switch to `:` but that we should instead
switch pkgid's to use ``@`,` in a backwards compatible way.  #10472 served
as the change proposal for this

See also
- https://internals.rust-lang.org/t/feedback-on-cargo-add-before-its-merged/16024/26?u=epage
- https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/Multiple.20ways.20of.20specifying.20versions

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

The focus of the testing is on the parsers unit tests and on the end-to-end output.  We are not explicitly testing end-to-end input in this PR, assuming the unit tests are sufficient.

### Additional information

This only focuses on places we already accept pkgids.  Looking into supporting `foo@1.2.3` in `cargo install` and `cargo yank` is being left for a future PR.

2 years agoAuto merge of #10631 - Muscraft:move-snapshot-tests, r=epage
bors [Fri, 6 May 2022 16:39:06 +0000 (16:39 +0000)]
Auto merge of #10631 - Muscraft:move-snapshot-tests, r=epage

move one `snapshot/add` test into `testsuite/cargo_add/`

This is an experiment with moving the test code related to a snapshot into the testsuite directory so it's easier to review.

- To kick the tire on these changes, a single test was ported

This is a step towards #10627.  A follow up will port all of the tests

r? `@epage`

2 years agomove a `snapshot/add/` test into `testsuite/cargo_add` directory
Scott Schafer [Fri, 6 May 2022 15:31:58 +0000 (10:31 -0500)]
move a `snapshot/add/` test into `testsuite/cargo_add` directory

2 years agoAuto merge of #10605 - yoav-lavi:patch-1, r=ehuss
bors [Thu, 5 May 2022 20:55:23 +0000 (20:55 +0000)]
Auto merge of #10605 - yoav-lavi:patch-1, r=ehuss

Add caveat for covering features

This section explains the caveats and possible solutions for features, detailing the tooling needed to 100% cover such a project.

The need for this PR is based on a conversation with `@Eh2406.`

Moved this PR here based on `@Eh2406's` comment: https://github.com/rust-lang/reference/pull/1195#issuecomment-1108968173

2 years agoAuto merge of #10633 - hi-rustin:rustin-patch-docs-variables, r=epage
bors [Thu, 5 May 2022 15:25:50 +0000 (15:25 +0000)]
Auto merge of #10633 - hi-rustin:rustin-patch-docs-variables, r=epage

Improve CARGO_ENCODED_RUSTFLAGS and CARGO_ENCODED_RUSTDOCFLAGS variables docs

### What does this PR try to resolve?

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

It has been improved according to the three requirements in the issue.

2 years agoImprove CARGO_ENCODED_RUSTFLAGS and CARGO_ENCODED_RUSTDOCFLAGS variables docs
hi-rustin [Thu, 5 May 2022 14:24:10 +0000 (22:24 +0800)]
Improve CARGO_ENCODED_RUSTFLAGS and CARGO_ENCODED_RUSTDOCFLAGS variables docs

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2 years agoAuto merge of #10629 - Muscraft:reorganize-snapshot-tests, r=epage
bors [Wed, 4 May 2022 14:42:24 +0000 (14:42 +0000)]
Auto merge of #10629 - Muscraft:reorganize-snapshot-tests, r=epage

reorganize `snapshot` tests to better work in contexts that sort by extension

Changed snapshot file stricture from
```
<name>.in/
<name>.out/
<name>.stdout
<name>.stderr
```

To
```
<name>/in/
<name>/out/
<name>/stdout.log
<name>/stderr.log
```

This makes it easier to review and make changes when in contexts that sort by extension

close #10626

r? `@epage`

2 years agoremove tests/snapshots/copy.sh and tests/snapshots/rename.sh
Scott Schafer [Wed, 4 May 2022 13:59:39 +0000 (08:59 -0500)]
remove tests/snapshots/copy.sh and tests/snapshots/rename.sh

2 years agoreorganize `snapshot` tests for `init` to better work in contexts that sort by extension
Scott Schafer [Wed, 4 May 2022 13:58:30 +0000 (08:58 -0500)]
reorganize `snapshot` tests for `init` to better work in contexts that sort by extension

2 years agoreorganize `snapshot` tests for `cargo-add` to better work in contexts that sort...
Scott Schafer [Wed, 4 May 2022 13:55:55 +0000 (08:55 -0500)]
reorganize `snapshot` tests for `cargo-add` to better work in contexts that sort by extension

2 years agoAuto merge of #10129 - jyn514:fetch-build-std, r=weihanglo
bors [Wed, 4 May 2022 02:29:34 +0000 (02:29 +0000)]
Auto merge of #10129 - jyn514:fetch-build-std, r=weihanglo

Add support for `-Zbuild-std` to `cargo fetch`

This allows downloading the dependencies for libstd in advance, which
can be useful in e.g. sandboxed build environments.

Fixes https://github.com/rust-lang/wg-cargo-std-aware/issues/22.

r? `@ehuss`

2 years agoAdd support for `-Zbuild-std` to `cargo fetch`
Joshua Nelson [Sat, 27 Nov 2021 19:08:14 +0000 (14:08 -0500)]
Add support for `-Zbuild-std` to `cargo fetch`

This allows downloading the dependencies for libstd in advance, which
can be useful in e.g. sandboxed build environments.

- Abstract check for `--target` out into a function
- Try to abstract `test` special-casing into a function

  This avoids hard-coding crate names in multiple places.

- Unify handling of checks for `--target` in `BuildConfig::new`

  This makes sure it's checked consistently, without requiring each new command to check it explicitly.

- Share more code between `fetch` and `build` by adding `std_crates()`
- Warn about `--build-plan` and `-Zbuild-std` consistently, not just for `build`

  Currently only `build` uses build-plan. But cargo may choose to add it to new commands in the future (e.g. check and doc).
  Future-proof it, since it's simple to do.

2 years agoWhen documenting private items in a binary, ignore warnings about links to private...
Joshua Nelson [Tue, 30 Nov 2021 19:25:55 +0000 (14:25 -0500)]
When documenting private items in a binary, ignore warnings about links to private items

Previously, rustdoc would warn about linking to items in a binary, even
though cargo unconditionally documents private items in a binary.
This changes cargo to silence the warning, since it's only relevant in
cases where the private items might not be documented.

2 years agoAuto merge of #10620 - weihanglo:snapbox-cargo-init, r=epage
bors [Wed, 4 May 2022 00:02:04 +0000 (00:02 +0000)]
Auto merge of #10620 - weihanglo:snapbox-cargo-init, r=epage

Migrate tests of `cargo-init` to snapbox

### What does this PR try to resolve?

An attempt of migrating tests of `cargo-init` to [snapbox](https://crates.io/crates/snapbox/).

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

To review this PR, you may compare the old and the new version one by one. Files not listed in `<test-name>.out` are not asserted, so please help me make sure we don't miss any essential file to check.

Some redundant tests are covered by other tests or renamed.

### Additional information

I won't say the process of the migration was pleasant, but overall it results to a higher coverage of output file changes. Here are steps I performed to migrate a test case:

1. Run the old test and observe its output layout. Recommend using a separate worktree to preserve the temporary test output files.
2. Read the test code to arrange its input fixture at `<test-name>.in`.
3. Copy the old output layout or hand-pick the output layout you need. You don't need to fill contents of those files. `snapbox` will do it for you.
4. Run `SNAPSHOTS=overwrite cargo test --test testsuite <your-test-filter>` to assert and generate snapshots.
5. Compare the old layout and the new layout to see if anything missing.

Something observations when dealing with the migration:

* snapbox hasn't yet support unordered assertion.
* snapbox cannot assert inexistence of a file (And probably never?).
* No performance hit so far (measured with hyperfine).

2 years agoNote that `.git` folder cannot be tracked under a git repo
Weihang Lo [Tue, 3 May 2022 22:32:02 +0000 (06:32 +0800)]
Note that `.git` folder cannot be tracked under a git repo

2 years agoUpdate features.md
Yoav Lavi [Tue, 3 May 2022 11:36:15 +0000 (13:36 +0200)]
Update features.md

2 years agoUse snapbox assertion instead of old `Project::cargo`
Weihang Lo [Tue, 3 May 2022 01:53:53 +0000 (09:53 +0800)]
Use snapbox assertion instead of old `Project::cargo`

2 years agoMake test fixture `rustfmt.toml` syntatically correct
Weihang Lo [Tue, 3 May 2022 01:48:00 +0000 (09:48 +0800)]
Make test fixture `rustfmt.toml` syntatically correct

2 years agoRename .gitkeep to .keep
Weihang Lo [Tue, 3 May 2022 00:44:52 +0000 (08:44 +0800)]
Rename .gitkeep to .keep

snapbox/trycmd won't copy ".keep" if present.

- <https://docs.rs/trycmd/0.13.4/trycmd/#in>
- <https://docs.rs/trycmd/0.13.4/trycmd/#out>

2 years agoUpdate changelog for upload to unstable.
Peter Michael Green [Mon, 2 May 2022 20:59:45 +0000 (20:59 +0000)]
Update changelog for upload to unstable.

2 years agoAdd `[EXE]` substitution in snapshots
Weihang Lo [Mon, 2 May 2022 00:42:28 +0000 (08:42 +0800)]
Add `[EXE]` substitution in snapshots

2 years agoAuto merge of #10619 - klensy:te-up, r=weihanglo
bors [Mon, 2 May 2022 00:39:25 +0000 (00:39 +0000)]
Auto merge of #10619 - klensy:te-up, r=weihanglo

dedupe toml_edit crate, followup #10603

Dedupe toml_edit crate versions, followup #10603

2 years agoMigrate tests of `cargo-init` to snapbox
Weihang Lo [Sun, 1 May 2022 01:29:09 +0000 (09:29 +0800)]
Migrate tests of `cargo-init` to snapbox

Some redundant tests are merged or deleted.

- `gitignore_appended_not_replaced` -> `git_ignore_exists_no_conflicting_entries`
- `gitignore_added_newline_in_existing` -> `git_ignore_exists_no_conflicting_entries`
- `gitignore_no_newline_in_new` -> `simple_git`
- `terminating_newline_in_existing_git_ignore` -> `git_ignore_exists_no_conflicting_entries`
- `terminating_newline_in_new_git_ignore` -> `simple_git`
- `terminating_newline_in_new_mercurial_ignore` -> `simple_hg`
- `terminating_newline_in_existing_mercurial_ignore` -> `simple_hg_ignore_exists`
- `mercurial_added_newline_in_existing` -> `simple_hg_ignore_exists`
- `mercurial_no_newline_in_new` -> `simple_hg`
- `cargo_lock_gitignored_if_lib1` -> `simple_git`
- `cargo_lock_gitignored_if_lib2` -> `inferred_lib_with_git`
- `cargo_lock_not_gitignored_if_bin2` -> `inferred_bin_with_git`
- `cargo_lock_not_gitignored_if_bin1` -> `explicit_bin_with_git`

2 years agodedupe toml_edit crate, followup #10603
klensy [Mon, 2 May 2022 00:03:43 +0000 (03:03 +0300)]
dedupe toml_edit crate, followup #10603

2 years agoAuto merge of #10618 - dtolnay-contrib:checkoutv3, r=ehuss
bors [Sat, 30 Apr 2022 21:26:16 +0000 (21:26 +0000)]
Auto merge of #10618 - dtolnay-contrib:checkoutv3, r=ehuss

Update GitHub Actions actions/checkout@v2 to v3

The v2 implementation uses Node 12, which is end-of-life on April 30, 2022. See https://nodejs.org/en/about/releases/. Update to v3, which is based on Node 16 whose support lasts until April 30, 2024.

They made this a major version change (v2 to v3) because old GitHub Enterprise versions aren't necessarily compatible with Node 16, but for github.com-supplied runners (SaaS) there is no practical difference.

2 years agoUpdate GitHub Actions actions/checkout@v2 to v3
David Tolnay [Sat, 30 Apr 2022 20:46:35 +0000 (13:46 -0700)]
Update GitHub Actions actions/checkout@v2 to v3

The v2 implementation uses Node 12, which is end-of-life on April 30, 2022.
See https://nodejs.org/en/about/releases/. Update to v3, which is based on
Node 16 whose support lasts until April 30, 2024.

2 years agoAuto merge of #10581 - epage:snapbox, r=ehuss
bors [Fri, 29 Apr 2022 19:18:36 +0000 (19:18 +0000)]
Auto merge of #10581 - epage:snapbox, r=ehuss

Integrate snapbox in with cargo-test-support

### What does this PR try to resolve?

#10472 introduced snapbox to cargo's tests in the least intrusive manner by copying some cargo-test-support code.  Primarily, this PR works to de-duplicate that code.  Secondarily, it makes it possible for snapbox to be used by other cargo tests that can work with its more limited functionality compared to cargo-test-support.

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

This is broken down by commits for smaller chunks to look over with some extra details in some of the commit messages.

As this is effectively refactoring existing tests, them passing is sufficient for testing.  The main focus would be on any API design including if there are any practices that we used to do that this continues forward to snapbox that we shouldn't.

### Additional information

The cargo contributing guide also needs to be updated but I'm leaving that off for another PR once this is merged so we have a clearer idea of what the API will look like (less churn) and so we can focus the conversation for each PR.

2 years agoAuto merge of #10613 - weihanglo:issue-10612, r=epage
bors [Fri, 29 Apr 2022 13:12:32 +0000 (13:12 +0000)]
Auto merge of #10613 - weihanglo:issue-10612, r=epage

Fix zsh completion

2 years agoFix zsh completion
Weihang Lo [Fri, 29 Apr 2022 06:13:18 +0000 (14:13 +0800)]
Fix zsh completion

2 years agoAuto merge of #10611 - Muscraft:workspace-inheritance-documentaion, r=epage
bors [Thu, 28 Apr 2022 19:29:10 +0000 (19:29 +0000)]
Auto merge of #10611 - Muscraft:workspace-inheritance-documentaion, r=epage

Update documentation for workspace inheritance

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

This updates documentation about workspace inheritance in the Cargo Book. This is meant to move the documentation into a state that is acceptable to move after stabilization. It currently proposes adding sections to `workspaces.md` and `specifying-dependencies.md`.

r? `@epage`

2 years agoUpdate documentation for workspace inheritance
Scott Schafer [Thu, 28 Apr 2022 19:19:56 +0000 (14:19 -0500)]
Update documentation for workspace inheritance

2 years agoAuto merge of #10609 - Muscraft:move-unstable-workspace-docs, r=epage
bors [Thu, 28 Apr 2022 03:15:50 +0000 (03:15 +0000)]
Auto merge of #10609 - Muscraft:move-unstable-workspace-docs, r=epage

move workspace inheritance untable docs to the correct place

Workspace inheritance unstable docs were under `Stabilized and removed features`. This moves them to the correct location

r? `@epage`

2 years agomove workspace inheritance untable docs to the correct place
Scott Schafer [Thu, 28 Apr 2022 03:11:41 +0000 (22:11 -0500)]
move workspace inheritance untable docs to the correct place

2 years agofeat(test-support): Make multi-argument strings avaialble to snapbox
Ed Page [Tue, 19 Apr 2022 17:18:20 +0000 (12:18 -0500)]
feat(test-support): Make multi-argument strings avaialble to snapbox

This is something the existing test infrastructure supports, so I
figured I'd make it mirror it for snapbox.  I'm mixed.
- It reads more like what a user would type, making it easier to run a
  test locally or take a manual test case and automate it
- It can make it harder to parse the arguments when scanning tests
- Without using a crate like `shlex`, the syntax support is unclear

2 years agofeat(test-support): Make it easy to launch cargo
Ed Page [Tue, 19 Apr 2022 16:54:42 +0000 (11:54 -0500)]
feat(test-support): Make it easy to launch cargo

2 years agofix(test-support): Default the current_dir for snapbox
Ed Page [Tue, 19 Apr 2022 16:23:03 +0000 (11:23 -0500)]
fix(test-support): Default the current_dir for snapbox

2 years agofeat(test-support): Expose test-env setup
Ed Page [Tue, 19 Apr 2022 16:18:38 +0000 (11:18 -0500)]
feat(test-support): Expose test-env setup

2 years agofeat(test-support): Expose `masquerade_as_nightly_cargo` to snapbox users
Ed Page [Tue, 19 Apr 2022 15:21:57 +0000 (10:21 -0500)]
feat(test-support): Expose `masquerade_as_nightly_cargo` to snapbox users

2 years agofeat(test-support): Share `Project::from_template` with all cargo tests
Ed Page [Mon, 18 Apr 2022 22:08:43 +0000 (17:08 -0500)]
feat(test-support): Share `Project::from_template` with all cargo tests

This was written for `cargo_add.rs`, based on `snapbox`.  This allows
creating a test from a known reproduction case or easily debugging on an
existing test case.

2 years agofeat(test-support): Allow reusing snapbox assertions
Ed Page [Mon, 18 Apr 2022 21:57:50 +0000 (16:57 -0500)]
feat(test-support): Allow reusing snapbox assertions

2 years agorefactor(test-support): Use snapbox to look up binaries
Ed Page [Mon, 18 Apr 2022 21:14:46 +0000 (16:14 -0500)]
refactor(test-support): Use snapbox to look up binaries

2 years agodoc(install): Tell users about `foo@version` syntax
Ed Page [Wed, 20 Apr 2022 15:31:40 +0000 (10:31 -0500)]
doc(install): Tell users about `foo@version` syntax

2 years agofeat(install): Support `foo@version` like cargo-add
Ed Page [Wed, 20 Apr 2022 14:53:35 +0000 (09:53 -0500)]
feat(install): Support `foo@version` like cargo-add

In #10472, cargo-add was merged with support for an inline version
syntax of `foo@version`.  That also served as the change proposal for
extending that syntax to `cargo install` for convinience and consistency.

While both commands are specifying a version-req, `cargo-install` has an
implicit-but-required `=` operand while `cargo-add` allows any operand.

This doesn't use the full `pkgid` syntax because that allows syntax that
is unsupported here.

This doesn't use `cargo-add`s parser because that is for version reqs.

I held off on reusing the parser from `cargo-yank` because they had
different type system needs and the level of duplication didn't seem
worth it (see Rule of Three).

2 years agorefactor(install): Allow per-crate versions in the API
Ed Page [Wed, 20 Apr 2022 14:43:05 +0000 (09:43 -0500)]
refactor(install): Allow per-crate versions in the API

2 years agoAuto merge of #10606 - Muscraft:cargo-add-support, r=epage
bors [Thu, 28 Apr 2022 00:40:41 +0000 (00:40 +0000)]
Auto merge of #10606 - Muscraft:cargo-add-support, r=epage

Cargo add support for workspace inheritance

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

This PR adds all the required support for workspace inheritance within `cargo-add`. It was split up across a few different PRs as it required `snapbox` support from #10581 and a new `toml_edit` version from #10603. `@epage` and I decided to go ahead with this PR and add in some of the changes those PRs made. `@epage's` name on the commits is from helping to rewrite commits and some very minor additions.

Changes:
  - #10585
  - https://github.com/Muscraft/cargo/pull/1
  - https://github.com/Muscraft/cargo/pull/3
  - https://github.com/Muscraft/cargo/pull/2
  - https://github.com/Muscraft/cargo/pull/4

r? `@epage`

2 years agoAuto merge of #10603 - epage:toml, r=ehuss
bors [Wed, 27 Apr 2022 22:20:42 +0000 (22:20 +0000)]
Auto merge of #10603 - epage:toml, r=ehuss

chore: Upgrade toml_edit

### What does this PR try to resolve?

This upgrades toml_edit and tries to make future upgrades easier.  To do this, it officially adds `toml_edit` to the public API but this will let RLS use these errors and stay up-to-date without manual intervention.

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

The main question is if we should have toml_edit in the API

### Additional information

See https://github.com/rust-lang/rls/pull/1764

2 years agoSupport overwriting a `foo.workspace = true` with a dependency from a different source
Scott Schafer [Wed, 27 Apr 2022 19:15:49 +0000 (14:15 -0500)]
Support overwriting a `foo.workspace = true` with a dependency from a different source