]> git.proxmox.com Git - cargo.git/log
cargo.git
3 years agoAuto merge of #9551 - hi-rustin:rustin-patch-clippy, r=alexcrichton
bors [Mon, 7 Jun 2021 14:00:09 +0000 (14:00 +0000)]
Auto merge of #9551 - hi-rustin:rustin-patch-clippy, r=alexcrichton

Make clippy happy

It is already a reference.

3 years agoMake clippy happy
hi-rustin [Mon, 7 Jun 2021 06:20:14 +0000 (14:20 +0800)]
Make clippy happy

3 years agoAuto merge of #9546 - ehuss:fingerprint-dead-code, r=Eh2406
bors [Sat, 5 Jun 2021 21:30:59 +0000 (21:30 +0000)]
Auto merge of #9546 - ehuss:fingerprint-dead-code, r=Eh2406

Remove some dead code.

3 years agoRemove some dead code.
Eric Huss [Sat, 5 Jun 2021 20:38:27 +0000 (13:38 -0700)]
Remove some dead code.

3 years agoAuto merge of #9515 - pickfire:patch-1, r=ehuss
bors [Sat, 5 Jun 2021 17:21:05 +0000 (17:21 +0000)]
Auto merge of #9515 - pickfire:patch-1, r=ehuss

Add additional test for CJK progress width

Not clear if CJK test hit boundary, since CJK characters have double width,
if we show an example with an extra single width means one of them hit
character boundary to be able to test ellipsis handling.

3 years agoAuto merge of #9544 - dtolnay-contrib:semverx, r=alexcrichton
bors [Fri, 4 Jun 2021 16:29:57 +0000 (16:29 +0000)]
Auto merge of #9544 - dtolnay-contrib:semverx, r=alexcrichton

Pull in semver 1.0.3 'x' fix

As requested in https://github.com/rust-lang/rust/pull/85983#issuecomment-854682640 -- a Cargo.toml update to ensure Cargo-the-library users always get https://github.com/dtolnay/semver/pull/247. Fixes https://github.com/rust-lang/cargo/issues/9543.

3 years agoPull in semver 1.0.3 'x' fix
David Tolnay [Fri, 4 Jun 2021 16:19:11 +0000 (09:19 -0700)]
Pull in semver 1.0.3 'x' fix

3 years agoAuto merge of #9540 - ehuss:unstable-tracking, r=alexcrichton
bors [Fri, 4 Jun 2021 15:32:26 +0000 (15:32 +0000)]
Auto merge of #9540 - ehuss:unstable-tracking, r=alexcrichton

Add some tracking issues to unstable docs.

3 years agoAuto merge of #9538 - ehuss:docs-include-exclude, r=alexcrichton
bors [Fri, 4 Jun 2021 15:05:30 +0000 (15:05 +0000)]
Auto merge of #9538 - ehuss:docs-include-exclude, r=alexcrichton

Update documentation for include/exclude.

Closes #9502.

3 years agoAuto merge of #9534 - ehuss:mdbook-contrib, r=alexcrichton
bors [Fri, 4 Jun 2021 13:59:39 +0000 (13:59 +0000)]
Auto merge of #9534 - ehuss:mdbook-contrib, r=alexcrichton

Bump mdbook version for contrib guide.

Just bringing in a few small fixes.

3 years agoAdd some tracking issues to unstable docs.
Eric Huss [Thu, 3 Jun 2021 20:48:36 +0000 (13:48 -0700)]
Add some tracking issues to unstable docs.

3 years agoUpdate documentation for include/exclude.
Eric Huss [Thu, 3 Jun 2021 17:26:35 +0000 (10:26 -0700)]
Update documentation for include/exclude.

3 years agoAdd additional test for CJK progress width
Ivan Tham [Thu, 27 May 2021 17:19:22 +0000 (01:19 +0800)]
Add additional test for CJK progress width

Not clear if CJK test hit boundary, since CJK characters have double width,
if we show an example with an extra single width means one of them hit
character boundary to be able to test ellipsis handling.

3 years agoBump mdbook version for contrib guide.
Eric Huss [Wed, 2 Jun 2021 22:41:47 +0000 (15:41 -0700)]
Bump mdbook version for contrib guide.

3 years agoAuto merge of #9533 - akien-mga:patch-to-replace-replace-with-patch, r=alexcrichton
bors [Wed, 2 Jun 2021 14:26:14 +0000 (14:26 +0000)]
Auto merge of #9533 - akien-mga:patch-to-replace-replace-with-patch, r=alexcrichton

Replace deprecated `[replace]` references with `[patch]`

Cf. #7092.

Note: Untested, but given the changes I figure that if the testsuite passes it should be fairly safe.

3 years agoReplace deprecated `[replace]` references with `[patch]`
Rémi Verschelde [Wed, 2 Jun 2021 10:28:52 +0000 (12:28 +0200)]
Replace deprecated `[replace]` references with `[patch]`

Cf. #7092.

3 years agoAuto merge of #9322 - jameshilliard:split-host, r=joshtriplett
bors [Tue, 1 Jun 2021 20:09:13 +0000 (20:09 +0000)]
Auto merge of #9322 - jameshilliard:split-host, r=joshtriplett

Configure hosts separately from targets when --target is specified.

This prevents target configs from accidentally being picked up when cross compiling from hosts that have the same architecture as their targets.

closes #3349

3 years agoAuto merge of #9523 - ehuss:link-args-validate, r=alexcrichton
bors [Tue, 1 Jun 2021 17:26:35 +0000 (17:26 +0000)]
Auto merge of #9523 - ehuss:link-args-validate, r=alexcrichton

Add some validation to rustc-link-arg

This adds some validation, so that if a `cargo:rustc-link-arg-*` build script instruction specifies a target that doesn't exist, it will generate an error.  This also changes a parse warning to an error if the `=` is missing from BIN=ARG.

I intentionally did not bother to add the validation to config overrides, as it is a bit trickier to do, and that feature is very rarely used (AFAIK), and I'm uncertain if rustc-link-arg is really useful in that context.

cc #9426

3 years agoAuto merge of #9420 - In-line:unknown-features-suggestions-in-workspace, r=ehuss
bors [Tue, 1 Jun 2021 15:41:27 +0000 (15:41 +0000)]
Auto merge of #9420 - In-line:unknown-features-suggestions-in-workspace, r=ehuss

Implement suggestions for unknown features in workspace

3 years agoAuto merge of #9529 - weihanglo:refactor/make_dep_path, r=alexcrichton
bors [Tue, 1 Jun 2021 15:02:22 +0000 (15:02 +0000)]
Auto merge of #9529 - weihanglo:refactor/make_dep_path, r=alexcrichton

Extract common `make_dep_path` to cargo_util

Just a teeny tiny refactor extracting the same logic.

3 years agoAuto merge of #9524 - ehuss:rustflags-compatibility, r=alexcrichton
bors [Tue, 1 Jun 2021 14:35:20 +0000 (14:35 +0000)]
Auto merge of #9524 - ehuss:rustflags-compatibility, r=alexcrichton

Add a note about rustflags compatibility.

Over time, Cargo occasionally starts issuing new flags that may conflict with flags the user is passing directly to the compiler. Some recent examples are `-C embed-bitcode` (which broke anyone passing `-Clto` manually), and `-C prefer-dynamic` (which is kind of a mess). Future conflicts might be things like `--remap-path-prefix` or `--extern-html-root-url` (for rustdoc). This adds a note to mention these potential conflicts.

Although we try to maintain backwards compatibility as much as possible throughout all of Cargo, this particular area I think is dangerous enough that it is prudent to have some kind of warning somewhere. It is very rare that conflicts arise in practice, but they can happen.

I also added a note about passing in flags that Cargo itself issues, which can cause problems. Closes #9358.

3 years agoAuto merge of #9526 - ehuss:doc-collision-resolve, r=alexcrichton
bors [Tue, 1 Jun 2021 14:12:14 +0000 (14:12 +0000)]
Auto merge of #9526 - ehuss:doc-collision-resolve, r=alexcrichton

Consolidate doc collision detection.

This removes the separate collision detection pass (in cargo_doc.rs) and uses the global collision detection instead. This removes the separate pass for running the resolver (which resulted in running the resolver four times every time `cargo doc` was run).

The `--open` option needs to know which path to open, so this is passed in a roundabout way via `Compilation`. Since this method uses the root units, I added a sort on the roots so that the crate that is opened is consistent between runs. This results in some slight behavioral changes.

This also makes the collision check slightly more stringent. The test `doc_multiple_targets_same_name` now generates an error instead of a warning because the old code did not check for collisions between libs and bins across packages (which should be very rare).

3 years agorefactor: extract common `make_dep_path` to cargo_util
Weihang Lo [Tue, 1 Jun 2021 02:28:36 +0000 (10:28 +0800)]
refactor: extract common `make_dep_path` to cargo_util

3 years agoConsolidate doc collision detection.
Eric Huss [Mon, 31 May 2021 02:39:48 +0000 (19:39 -0700)]
Consolidate doc collision detection.

3 years agoAdd a note about passing in rustflags that conflict with Cargo.
Eric Huss [Sun, 30 May 2021 01:17:03 +0000 (18:17 -0700)]
Add a note about passing in rustflags that conflict with Cargo.

3 years agoAdd a note about rustflags compatibility.
Eric Huss [Sun, 30 May 2021 00:44:16 +0000 (17:44 -0700)]
Add a note about rustflags compatibility.

3 years agoMake cargo:rustc-link-arg-bin without the `=` an error.
Eric Huss [Sat, 29 May 2021 23:12:11 +0000 (16:12 -0700)]
Make cargo:rustc-link-arg-bin without the `=` an error.

3 years agoAdd some errors if rustc-link-arg-* specifies a non-existent target.
Eric Huss [Sat, 29 May 2021 23:00:35 +0000 (16:00 -0700)]
Add some errors if rustc-link-arg-* specifies a non-existent target.

3 years agocustom_build.rs: Import anyhow::bail
Eric Huss [Sat, 29 May 2021 20:36:31 +0000 (13:36 -0700)]
custom_build.rs: Import anyhow::bail

3 years agoAuto merge of #9499 - weihanglo:tree-depth, r=ehuss
bors [Fri, 28 May 2021 16:27:46 +0000 (16:27 +0000)]
Auto merge of #9499 - weihanglo:tree-depth, r=ehuss

Add `--depth` option for `cargo-tree`

Part of #8105

Note that the `--depth` option only regards the "tree" depth but not dependency depth.

## To resolve

Bike-shedding naming problem: `-L,--level`  or `--depth`?

3 years agoMerge branch 'master' into tree-depth
Weihang Lo [Fri, 28 May 2021 15:27:42 +0000 (23:27 +0800)]
Merge branch 'master' into tree-depth

3 years agoAuto merge of #9488 - weihanglo:issue-9165, r=ehuss
bors [Fri, 28 May 2021 14:55:26 +0000 (14:55 +0000)]
Auto merge of #9488 - weihanglo:issue-9165, r=ehuss

`cargo tree -e no-proc-macro` to hide procedural macro dependencies

Probably resolves #9165

`cargo tree -e no-proc-macro` now hides procedural macro dependencies.

Note that when passed with `--invert <spec>`, the spec's reverse proc-macro dependencies are also hidden. Is this desired result?

Also, since I want `-p <spec>` and `-i <spec>` works with any valid package-id in the project, the filter logic is written in print stage instead of graph build stage

3 years agofix: remove unnecessary match bindings
Weihang Lo [Thu, 27 May 2021 23:25:57 +0000 (07:25 +0800)]
fix: remove unnecessary match bindings

Co-authored-by: Eric Huss <eric@huss.org>
3 years agoAuto merge of #9508 - dtolnay-contrib:semver, r=ehuss
bors [Thu, 27 May 2021 22:34:28 +0000 (22:34 +0000)]
Auto merge of #9508 - dtolnay-contrib:semver, r=ehuss

Update to semver 1.0.0

I am working on a 1.0.0 of the `semver` crate some time this week. It would be good to confirm Cargo will be able to use it, beforehand!

It's a from-scratch rewrite, but https://github.com/dtolnay/semver/issues/237 has code to compare against 0.10.0 (currently used by Cargo) how every possible version requirement currently published to crates.io matches against every possible crate version. The differences are all broken syntax like `^0-.11.0` previously parsing with ".11.0" as a pre-release string (which is invalid, because pre-release are not allowed to contain empty dot-separated identifiers) and `~2.0-2.2` previously parsing with "2.2" as a pre-release string, when the user almost certainly meant `>=2.0, <=2.2`. I'm not sure how much of those you want to add code into Cargo to preserve behavior, but I would be happy to do it.

3 years agoAuto merge of #9517 - alexcrichton:update-rrar, r=ehuss
bors [Thu, 27 May 2021 22:08:08 +0000 (22:08 +0000)]
Auto merge of #9517 - alexcrichton:update-rrar, r=ehuss

Update tar dependency to 0.4.35

Pulls in a fix which should avoid 0 mtime files from showing up.

Closes #9512

3 years agoUpdate tar dependency to 0.4.34
Alex Crichton [Thu, 27 May 2021 19:48:31 +0000 (12:48 -0700)]
Update tar dependency to 0.4.34

Pulls in a fix which should avoid 0 mtime files from showing up.

Closes #9512

3 years agoUpdate to semver 1.0.0
David Tolnay [Wed, 26 May 2021 21:39:13 +0000 (14:39 -0700)]
Update to semver 1.0.0

3 years agoRemove parsing of broken version syntax from 5 years ago
David Tolnay [Wed, 26 May 2021 21:26:44 +0000 (14:26 -0700)]
Remove parsing of broken version syntax from 5 years ago

3 years agoUpdate to semver 1.0.0-rc
David Tolnay [Tue, 25 May 2021 23:46:11 +0000 (16:46 -0700)]
Update to semver 1.0.0-rc

3 years agoAuto merge of #9486 - Dirbaio:link-arg-bin, r=ehuss
bors [Mon, 24 May 2021 16:17:27 +0000 (16:17 +0000)]
Auto merge of #9486 - Dirbaio:link-arg-bin, r=ehuss

Add `cargo:rustc-link-arg-bin` flag.

This PR implements a `cargo:rustc-link-arg-bin` command to specify per-binary link args from build scripts. This follows the suggestion from the tracking issue #9426.

Syntax is `cargo:rustc-link-arg-bin=BIN_NAME=ARG`

This was previously possible to do using the `#[link_args=".."]` attribute, but it was removed in rust-lang/rust#83820 in favor of the Cargo extra-link-args feature, which can currently not specify different link args for different bins in the same crate. This PR adds back the ability to do that.

3 years agoAuto merge of #9473 - lf-:meow, r=ehuss
bors [Mon, 24 May 2021 15:54:16 +0000 (15:54 +0000)]
Auto merge of #9473 - lf-:meow, r=ehuss

Add a cargo-doc.browser config option

The idea of this option is to allow cargo to use a separate browser from
the rest of the system. My motivation in doing this is that I want to
write a script that adds a symbolic link in some web root on my system
such that I can access my docs via the http protocol to avoid the
limitations of the file protocol that are accessibility problems for me.
For instance, zoom is not retained across multiple pages and Stylus
filters don't work well.

3 years agoAuto merge of #9437 - In-line:unknown-feature-resolver-1, r=ehuss
bors [Mon, 24 May 2021 15:20:48 +0000 (15:20 +0000)]
Auto merge of #9437 - In-line:unknown-feature-resolver-1, r=ehuss

 Fix bug when with resolver = "1" non-virtual package was allowing unknown features

3 years agoRemove unneeded masquerade_as_nightly_cargo.
Eric Huss [Mon, 24 May 2021 15:18:14 +0000 (08:18 -0700)]
Remove unneeded masquerade_as_nightly_cargo.

This was accidentally missed when it was stabilized.

3 years agodocs: `cargo-doc.browser` -> `doc.browser`; mention in cargo-{rust,}doc.1
Jade [Fri, 21 May 2021 05:52:49 +0000 (22:52 -0700)]
docs: `cargo-doc.browser` -> `doc.browser`; mention in cargo-{rust,}doc.1

3 years agoAdd unstable docs for `cargo:rustc-link-arg-bin=foo=--bar`
Dario Nieuwenhuis [Thu, 20 May 2021 19:50:50 +0000 (21:50 +0200)]
Add unstable docs for `cargo:rustc-link-arg-bin=foo=--bar`

3 years agoAdd test for `cargo:rustc-link-arg-bin=foo=--bar`
Dario Nieuwenhuis [Thu, 20 May 2021 19:41:17 +0000 (21:41 +0200)]
Add test for `cargo:rustc-link-arg-bin=foo=--bar`

3 years agoAdd rustc-link-arg-bin key to specify per-bin link args.
Dario Nieuwenhuis [Fri, 14 May 2021 20:13:57 +0000 (22:13 +0200)]
Add rustc-link-arg-bin key to specify per-bin link args.

3 years agoAllow LinkType to access the Target for checking if it applies.
Dario Nieuwenhuis [Tue, 11 May 2021 22:21:35 +0000 (00:21 +0200)]
Allow LinkType to access the Target for checking if it applies.

3 years agoCargo fmt
Alik Aslanyan [Thu, 20 May 2021 04:36:01 +0000 (08:36 +0400)]
Cargo fmt

3 years agoMerge branch 'master' of github.com:rust-lang/cargo into unknown-feature-resolver-1
Alik Aslanyan [Thu, 20 May 2021 04:34:48 +0000 (08:34 +0400)]
Merge branch 'master' of github.com:rust-lang/cargo into unknown-feature-resolver-1

3 years agoRevert fmt
Alik Aslanyan [Thu, 20 May 2021 04:33:57 +0000 (08:33 +0400)]
Revert fmt

3 years agoRevert unnecessary changes
Alik Aslanyan [Thu, 20 May 2021 04:31:57 +0000 (08:31 +0400)]
Revert unnecessary changes

3 years agodoc: generated via build-man.sh
Weihang Lo [Wed, 19 May 2021 01:25:23 +0000 (09:25 +0800)]
doc: generated via build-man.sh

3 years agodoc(cargo-tree): add `--depth` option
Weihang Lo [Wed, 19 May 2021 01:24:52 +0000 (09:24 +0800)]
doc(cargo-tree): add `--depth` option

3 years agotest(cargo-tree): `--depth` option
Weihang Lo [Wed, 19 May 2021 00:52:45 +0000 (08:52 +0800)]
test(cargo-tree): `--depth` option

3 years agofeat: new `--depth` option for `cargo tree`
Weihang Lo [Sun, 16 May 2021 16:49:12 +0000 (00:49 +0800)]
feat: new `--depth` option for `cargo tree`

3 years agoAuto merge of #9493 - ehuss:contrib-git-url, r=alexcrichton
bors [Tue, 18 May 2021 21:48:52 +0000 (21:48 +0000)]
Auto merge of #9493 - ehuss:contrib-git-url, r=alexcrichton

Add GitHub link to contributor guide.

This adds a small icon on each page that links back to the GitHub source.

3 years agoAuto merge of #9498 - ehuss:rustup-windows-workaround, r=alexcrichton
bors [Tue, 18 May 2021 20:47:05 +0000 (20:47 +0000)]
Auto merge of #9498 - ehuss:rustup-windows-workaround, r=alexcrichton

Add temporary fix for rustup on windows in CI.

This adds a temporary fix for rustup on the Windows CI runners. The GitHub image updated to rustup 1.24.1 which has an issue (https://github.com/rust-lang/rustup/issues/2759) causing them to fail.  This is fixed in 1.24.2.  I believe the images are updated on roughly a weekly basis, and from what I can see the image just downloads the most recently release, so hopefully this will be fixed on GitHub's side in roughly a week. Until then, this will force rustup to update.

Note: Self updates aren't available on macOS images, but they seem to work on the others.

3 years agoAdd temporary fix for rustup on windows in CI.
Eric Huss [Tue, 18 May 2021 20:32:04 +0000 (13:32 -0700)]
Add temporary fix for rustup on windows in CI.

3 years agoAuto merge of #9495 - dunkyl:master, r=ehuss
bors [Tue, 18 May 2021 14:05:33 +0000 (14:05 +0000)]
Auto merge of #9495 - dunkyl:master, r=ehuss

3 typos and some capitalization

3 typos and...

Most of the docs use "command-line" instead of "commandline", changed where it made sense (in plain text).

Most of the docs also use "SemVer" instead of "semver", changed for consistency except for the "semver trick" (consistent with context).

I believe these are the correct files to change, since none of these changes are in doc/man?

3 years agoCapitalization
dunkyl [Tue, 18 May 2021 05:49:50 +0000 (22:49 -0700)]
Capitalization

SemVer

Rust capitalization

3 years agotypo
dunkyl [Tue, 18 May 2021 05:49:17 +0000 (22:49 -0700)]
typo

3 years agodash-style command-line
dunkyl [Tue, 18 May 2021 05:18:10 +0000 (22:18 -0700)]
dash-style command-line

3 years ago2 typos
dunkyl [Tue, 18 May 2021 05:17:31 +0000 (22:17 -0700)]
2 typos

3 years agoAdd GitHub link to contributor guide.
Eric Huss [Mon, 17 May 2021 21:52:37 +0000 (14:52 -0700)]
Add GitHub link to contributor guide.

3 years agotestsuite/doc: Check the arguments used to invoke the browser
Jade [Sun, 16 May 2021 01:59:24 +0000 (18:59 -0700)]
testsuite/doc: Check the arguments used to invoke the browser

Previously we apparently weren't doing this as we weren't checking
stdout.

3 years agotest path and args
Jade [Sat, 15 May 2021 21:21:13 +0000 (14:21 -0700)]
test path and args

3 years agoMove browser setting to [doc], use PathAndArgs
Jade [Sat, 15 May 2021 20:23:55 +0000 (13:23 -0700)]
Move browser setting to [doc], use PathAndArgs

3 years agorefactor: move arg manipulations into commands
Weihang Lo [Sat, 15 May 2021 18:03:43 +0000 (02:03 +0800)]
refactor: move arg manipulations into commands

3 years agodoc: generated via build-man.sh
Weihang Lo [Sat, 15 May 2021 18:02:50 +0000 (02:02 +0800)]
doc: generated via build-man.sh

3 years agodoc: add `no-proc-macro` description for `--edges`
Weihang Lo [Sat, 15 May 2021 18:01:50 +0000 (02:01 +0800)]
doc: add `no-proc-macro` description for `--edges`

3 years agotest: `cargo tree` incorrect `--edges` arg
Weihang Lo [Sat, 15 May 2021 18:00:56 +0000 (02:00 +0800)]
test: `cargo tree` incorrect `--edges` arg

3 years agotest: assert no-proc-macro for existing tests
Weihang Lo [Sat, 15 May 2021 18:00:22 +0000 (02:00 +0800)]
test: assert no-proc-macro for existing tests

3 years agofeat: add `no-proc-macro` for `--edges` option
Weihang Lo [Sat, 15 May 2021 15:30:59 +0000 (23:30 +0800)]
feat: add `no-proc-macro` for `--edges` option

3 years agoAuto merge of #9484 - kklibo:master, r=ehuss
bors [Fri, 14 May 2021 00:59:52 +0000 (00:59 +0000)]
Auto merge of #9484 - kklibo:master, r=ehuss

fix 6 typos

Fixes #9483

3 years agofix 6 typos
kklibo [Fri, 14 May 2021 00:36:02 +0000 (17:36 -0700)]
fix 6 typos

3 years agoAnother way to fix
Alik Aslanyan [Thu, 13 May 2021 07:30:20 +0000 (11:30 +0400)]
Another way to fix

3 years agoAuto merge of #9468 - PaulDance:fix-rustdoc-warnings, r=ehuss
bors [Tue, 11 May 2021 18:12:23 +0000 (18:12 +0000)]
Auto merge of #9468 - PaulDance:fix-rustdoc-warnings, r=ehuss

Fix rustdoc warnings

Change some small parts of the unit documentation in order to resolve warnings emitted when running `cargo doc` from the root of this project. It should help reduce the noise when checking that new or updated documentation builds correctly.

See the commit messages for details about the modifications themselves, although they should be rather simple.

Cheers,
Paul.

3 years agoAuto merge of #9478 - ehuss:faster-git-status, r=alexcrichton
bors [Tue, 11 May 2021 14:22:21 +0000 (14:22 +0000)]
Auto merge of #9478 - ehuss:faster-git-status, r=alexcrichton

Improve performance of git status check in `cargo package`.

The check for a dirty repository during packaging/publishing is quite slow. It was calling `status_file` for every packaged file, which is very expensive. I have a directory that had about 10,000 untracked files. Previously, cargo would hang for over 2 minutes without any output. With this PR, it finishes in 0.3 seconds.

The solution here is to collect the status information once, and then compare the package list against it.

One subtle point is that it does not use `recurse_untracked_dirs`, and instead relies on a primitive `starts_with` comparison, which I believe should be equivalent.

This still includes an inefficient n^2 algorithm, but I am too lazy to make a better approach.

I'm moderately confident this is pretty much the same as before (at least, all the scenarios I could think of).

3 years agoAdd a cargo-doc.browser config option
Jade [Mon, 10 May 2021 10:36:12 +0000 (03:36 -0700)]
Add a cargo-doc.browser config option

The idea of this option is to allow cargo to use a separate browser from
the rest of the system. My motivation in doing this is that I want to
write a script that adds a symbolic link in some web root on my system
such that I can access my docs via the http protocol to avoid the
limitations of the file protocol that are accessibility problems for me.
For instance, zoom is not retained across multiple pages and Stylus
filters don't work well.

3 years agoImprove performance of git status check in `cargo package`.
Eric Huss [Tue, 11 May 2021 01:15:05 +0000 (18:15 -0700)]
Improve performance of git status check in `cargo package`.

3 years agoAuto merge of #9477 - ehuss:link-test-chapter, r=alexcrichton
bors [Mon, 10 May 2021 23:32:46 +0000 (23:32 +0000)]
Auto merge of #9477 - ehuss:link-test-chapter, r=alexcrichton

Link to the new rustc tests chapter.

There's a new chapter in the rustc book on how the libtest harness works, and the command-line options it offers. This adds a few links to that new chapter in the cargo book.

3 years agoAuto merge of #9476 - ehuss:index-cache-bump, r=alexcrichton
bors [Mon, 10 May 2021 23:04:32 +0000 (23:04 +0000)]
Auto merge of #9476 - ehuss:index-cache-bump, r=alexcrichton

Bump index cache version to deal with semver metadata version mismatch.

#9467 has uncovered an issue with how versions are handled in the index cache.  When using a debug build of Cargo, it may panic due to the [cache contents changing](https://github.com/rust-lang/cargo/blob/5c455130b6001c7f54e872e161c27f6e996aff1f/src/cargo/sources/registry/index.rs#L606-L619).  The particular problem I am running into is that the index has an entry for `openssl-src 110.0.0` and `110.0.0+1.1.0f`. This is due to an issue with crates.io where it allows publishing multiple versions with the same metadata (https://github.com/rust-lang/crates.io/issues/1059).  Cargos before #9467 would populate the index cache with two entries, both with version `110.0.0`.  Afterwards, there are two separate entries (`110.0.0` and `110.0.0+1.1.0f`).

The change here is to bump the index cache version so that new versions of cargo will clear the cache, and won't trigger the assertion.

This may be a bit of a heavy-handed solution, as I think this only affects debug builds of cargo.  However, I instantly started running into this problem, so I suspect it will be a real annoyance for anyone developing cargo. Happy to discuss other possible solutions.

3 years agoLink to the new rustc tests chapter.
Eric Huss [Thu, 22 Apr 2021 00:37:12 +0000 (17:37 -0700)]
Link to the new rustc tests chapter.

3 years agoBump index cache version.
Eric Huss [Mon, 10 May 2021 22:15:26 +0000 (15:15 -0700)]
Bump index cache version.

3 years agoAuto merge of #9475 - PaulDance:fix-test-support-warning, r=ehuss
bors [Mon, 10 May 2021 21:39:52 +0000 (21:39 +0000)]
Auto merge of #9475 - PaulDance:fix-test-support-warning, r=ehuss

Fix Url::into_string deprecation warning

```rust
warning: use of deprecated associated function `url::Url::into_string`: use Into<String>
   --> src/registry.rs:183:26
    |
183 |                 dl_url().into_string(),
    |                          ^^^^^^^^^^^
    |
    = note: `#[warn(deprecated)]` on by default
```

is being emitted when running `cargo build` directly from the `crates/cargo-test-support` or the `crates/mdman` crate. This simply proposes a switch to the recommended method in order to resolve the deprecation warning.

3 years agoBump `url` to 2.2.2 where `Into<String>` for `Url` is used
Paul Mabileau [Mon, 10 May 2021 20:20:11 +0000 (22:20 +0200)]
Bump `url` to 2.2.2 where `Into<String>` for `Url` is used

The base package, `cargo-test-support` and `mdman`.

Signed-off-by: Paul Mabileau <paulmabileau@hotmail.fr>
3 years agoFix Url::into_string deprecation warning
Paul Mabileau [Mon, 10 May 2021 17:51:02 +0000 (19:51 +0200)]
Fix Url::into_string deprecation warning

`url::Url::into_string` is deprecated. The `Into<String>` implementation
is now used.

Signed-off-by: Paul Mabileau <paulmabileau@hotmail.fr>
3 years agoAuto merge of #9469 - PaulDance:fossil-local-settings, r=ehuss
bors [Mon, 10 May 2021 17:26:27 +0000 (17:26 +0000)]
Auto merge of #9469 - PaulDance:fossil-local-settings, r=ehuss

Fix #4482 and #9449: set Fossil ignore and clean settings locally

This aims to close #4482 and close #9449.

Context: currently, the Fossil extension for `cargo new` would call `fossil settings [...]` in order to configure the created repository to ignore and allow cleaning the `target` build directory. However, as #9449 shows, it is ran from the CWD, which is probably outside of the repo, therefore it modifies global settings instead of local ones. This PR fixes that by writing the settings to local versioned files as the issue recommends.

Furthermore, as #9449 notes, configuring the repository's ignore settings only in `util::vcs::FossilRepo::init` means it is not done when the repository is not new and makes it harder to maintain equivalent support for VCS ignore system implementations. It also completely ignores the `--lib` CLI option which adds `Cargo.lock` to the ignore list for Git and Mercurial.

Therefore, the following modifications have been performed, using [the Fossil documentation](https://fossil-scm.org/home/doc/trunk/www/globs.md) as a reference for the ignore syntax:

 * All settings logic has been removed from `FossilRepo::init`.
 * `ops::cargo_new::IgnoreList::push` now requires a third argument for Fossil-specific glob syntax that is stored in a new `fossil_ignore` field.
 * `IgnoreList::format_new` uses the `fossil_ignore` field when needed just like any other VCS.
 * `IgnoreList::format_existing` handles Fossil separately for a few operations as its glob syntax does not support comments, so any lines starting with `#` cannot be included: the configurations can only be merged here.
 * `write_ignore_file` has been modified a bit as well to enable writing to two files for Fossil specifically in order to keep supporting its cleaning feature. The return type of the function is now `CargoResult<()>` instead `CargoResult<String>`: it makes the implementation easier and as the return value was actually not used, I figured it would be okay to do so, plus that return value would not make too much sense anymore for Fossil because of the two possibly different file contents.
 * `mk` has been updated to provide the correct ignore glob to `IgnoreList::push` for Fossil.

3 years agoAuto merge of #9472 - r00ster91:bettererrors, r=alexcrichton
bors [Mon, 10 May 2021 15:35:17 +0000 (15:35 +0000)]
Auto merge of #9472 - r00ster91:bettererrors, r=alexcrichton

Improve two error messages

The first error message saying "an integer" is confusing because if you give it `4` it's an integer but it will still complain that it must be an integer. So it's more specific now and tells you that it actually needs to be `1`, `2` or `3`.
In the second error there was a space missing. It says `is not a valid setting,must be`.

3 years agoImprove two error messages
r00ster91 [Mon, 10 May 2021 15:28:19 +0000 (17:28 +0200)]
Improve two error messages

3 years agoAuto merge of #9467 - ehuss:install-metadata, r=alexcrichton
bors [Mon, 10 May 2021 13:47:40 +0000 (13:47 +0000)]
Auto merge of #9467 - ehuss:install-metadata, r=alexcrichton

Fix `cargo install` with a semver metadata version.

This fixes an issue where `cargo install cargo-c --version 0.8.0+cargo-0.51` fails (returns a 404 error when downloading) when the index has not yet been populated through other means. The crux of the issue is that the `PackageId` interner was treating `0.8.0+cargo-0.51` and `0.8.0` the same. Due to a chain of events, the interner was getting populated with `0.8.0` first, and then from there on always returned `0.8.0`. The full version information is needed to construct the download URL, so it was failing.

The reason the interner was getting populated with a version without the metadata is the following sequence of events:

1. There is [this "fast path" code path](https://github.com/rust-lang/cargo/blob/d1baf0d81d0e4f91881de8e544c71fb49f623047/src/cargo/ops/cargo_install.rs#L570) which checks if a version of a package is already installed *before updating the index*.
2. Since the index doesn't exist yet, the resolver query returns zero entries (because the Registry Source is empty) [here](https://github.com/rust-lang/cargo/blob/d1baf0d81d0e4f91881de8e544c71fb49f623047/src/cargo/ops/common_for_install_and_uninstall.rs#L546-L550).
3. That code checks if the package has been yanked (because it can't tell the difference between "yanked" and "index not downloaded, yet").
4. It constructs a `PackageId` using a `VersionReq` where the build metadata has been removed (because version reqs don't have build metadata).
5. When the real install continues (the error here is ignored for the purpose of this fast-path check if it is already installed), it downloads the index. However, the `PackageId` values created when parsing the index JSON files are now missing the build metadata because the interner is returning the wrong entries.
6. When the download starts, the URL is built from the `PackageId` missing the build metadata.

I only changed `PackageIdInner` to pay attention to the build metadata. This seems a bit fragile, as perhaps `PackageId` should also pay attention to it. However, I don't really want to do an audit of every use of `PackageId`, and offhand I can't think of other situations where it would matter.

Closes #9410

3 years agoSet Fossil ignore and clean settings locally
Paul Mabileau [Sun, 9 May 2021 20:13:55 +0000 (22:13 +0200)]
Set Fossil ignore and clean settings locally

Previously, the Fossil extension for `cargo new` would call `fossil
settings [...]` in order to configure the created repository to ignore
and allow cleaning the `target` build directory. However, as #9449
shows, it is ran from the CWD, which is probably outside of the repo,
therefore it modifies global settings instead of local ones. This aims
to fix that by writing the settings to local versioned files as the
issue recommends.

Signed-off-by: Paul Mabileau <paulmabileau@hotmail.fr>
3 years agoFix doc warnings for cargo-util::paths
Paul Mabileau [Sun, 9 May 2021 17:47:08 +0000 (19:47 +0200)]
Fix doc warnings for cargo-util::paths

Add parentheses to disambiguate from `write!`.

Signed-off-by: Paul Mabileau <paulmabileau@hotmail.fr>
3 years agoResolve doc warnings for RegistryData
Paul Mabileau [Sun, 9 May 2021 17:37:13 +0000 (19:37 +0200)]
Resolve doc warnings for RegistryData

Specify `Self::finish_download` instead of just `finish_download` and
link to `crate::core::package::Downloads` instead of `Download` as
`Downloads` is the public one, does the actual stuff and `Download` only
stores data.

Signed-off-by: Paul Mabileau <paulmabileau@hotmail.fr>
3 years agoFix rustdoc warnings for RegistrySource and RegistryData
Paul Mabileau [Sun, 9 May 2021 17:25:45 +0000 (19:25 +0200)]
Fix rustdoc warnings for RegistrySource and RegistryData

Inline the link targets directly in the text.

Signed-off-by: Paul Mabileau <paulmabileau@hotmail.fr>
3 years agoRemove rustdoc warnings for core::features
Paul Mabileau [Sun, 9 May 2021 17:14:52 +0000 (19:14 +0200)]
Remove rustdoc warnings for core::features

Link `CliUnstable::add` just to `CliUnstable` instead.

Signed-off-by: Paul Mabileau <paulmabileau@hotmail.fr>
3 years agoFix `cargo install` with a semver metadata version.
Eric Huss [Sat, 8 May 2021 23:31:09 +0000 (16:31 -0700)]
Fix `cargo install` with a semver metadata version.

3 years agoAuto merge of #9375 - vojtechkral:tests-target-dir, r=ehuss
bors [Fri, 7 May 2021 21:29:52 +0000 (21:29 +0000)]
Auto merge of #9375 - vojtechkral:tests-target-dir, r=ehuss

Add CARGO_TARGET_TMPDIR env var for integration tests & benches

Hi.
Recently I [ran into](https://github.com/vojtechkral/bard/blob/main/tests/util/mod.rs#L32) the problem that integration tests don't have a good way to figure out where `target` dir is.

Knowing where `target` is is useful for integration tests that need to setup some filesystem structure for test cases. In fact `cargo` itself does this too (and figures out the path rather clumsily).

Another popular way of doing this is to create a directory in `/tmp` (or quivalent on other systems), however, I believe using subdirectory in `target` is better as testcases are easier to debug that way and temporary  locations aren't polluted.

I think this would also address some concerns in #2841

Another solution might be to provide a dedicated subdirectory in `target` for this, something like `target/scratchpad`, but I'm not convinced this is warranted... Edit: That's what was decided to do, see below...

Let me know what you think :slightly_smiling_face:

3 years agoAuto merge of #9464 - ehuss:version-bump, r=Eh2406
bors [Fri, 7 May 2021 18:59:28 +0000 (18:59 +0000)]
Auto merge of #9464 - ehuss:version-bump, r=Eh2406

Bump to 0.55.0, update changelog