]> git.proxmox.com Git - cargo.git/log
cargo.git
4 years agotest: glob support for target selection
Weihang Lo [Sun, 4 Oct 2020 15:25:53 +0000 (23:25 +0800)]
test: glob support for target selection

4 years agofeat: glob support for target selection
Weihang Lo [Sun, 4 Oct 2020 15:22:54 +0000 (23:22 +0800)]
feat: glob support for target selection

4 years agotest: minimal shell quote supoort for cargo-test-support
Weihang Lo [Sun, 4 Oct 2020 14:55:50 +0000 (22:55 +0800)]
test: minimal shell quote supoort for cargo-test-support

4 years agoAuto merge of #8744 - roblabla:homepage-doc-cargo-metadata, r=alexcrichton
bors [Fri, 2 Oct 2020 14:53:21 +0000 (14:53 +0000)]
Auto merge of #8744 - roblabla:homepage-doc-cargo-metadata, r=alexcrichton

Homepage doc cargo metadata

Adds two new field to cargo-metadata: `homepage` and `documentation`, lifted directly from the Cargo.toml. This additionally makes those fields available through `cargo read-manifest`.

4 years agoAdd homepage/documentation to cargo-metadata docs
roblabla [Thu, 1 Oct 2020 09:24:22 +0000 (09:24 +0000)]
Add homepage/documentation to cargo-metadata docs

4 years agoTest that homepage/documentation values are properly propagated
roblabla [Thu, 1 Oct 2020 09:23:06 +0000 (09:23 +0000)]
Test that homepage/documentation values are properly propagated

4 years agoFix tests
roblabla [Thu, 1 Oct 2020 09:22:49 +0000 (09:22 +0000)]
Fix tests

4 years agoAdd homepage and documentation to package in cargo metadata
roblabla [Thu, 1 Oct 2020 08:49:06 +0000 (08:49 +0000)]
Add homepage and documentation to package in cargo metadata

4 years agoAuto merge of #8741 - est31:makeflags, r=alexcrichton
bors [Tue, 29 Sep 2020 18:42:19 +0000 (18:42 +0000)]
Auto merge of #8741 - est31:makeflags, r=alexcrichton

Correct mistake about supporting sub-makes and document CARGO_MAKEFLAGS

Sub-makes are currently not supported as the jobserver crate only
sets CARGO_MAKEFLAGS which GNU Make doesn't understand.

This might be reasonable as cargo overriding existing MAKEFLAGS
variables would be weird, but also makes the statement in the
reference false.

It's helpful for build script authors who want to invoke make
to know how to get make subprocesses work with parallel builds.

4 years agoAuto merge of #8742 - ehuss:proc-macro-test-feature, r=alexcrichton
bors [Tue, 29 Sep 2020 18:17:36 +0000 (18:17 +0000)]
Auto merge of #8742 - ehuss:proc-macro-test-feature, r=alexcrichton

Properly set for_host for proc-macro tests.

Proc-macro tests are currently forced to run for the host target (by [this line of code](https://github.com/rust-lang/cargo/blob/898ccde7ac867ecdb62184714b379c4328409399/src/cargo/ops/cargo_compile.rs#L819)). However, the code that builds the dependency graph wasn't playing by the same rules, and was building the proc-macro test as-if it was "not for_host".  This would cause the proc-macro test to pull in the wrong set of dependencies/features with the new feature resolver.

Forcing proc-macro tests to run on host isn't 100% required, since most targets have the proc_macro crate available. However, I feel like it simplifies things to build for-host. I was thinking we could relax that requirement, but I'm not really sure.  See also #4336 where there's an bug if you do specify `--target`.

Tested with the wasmtime repo running `cargo test -Zfeatures=all -p wiggle-macro` with `doctest = false` commented out of `crates/wiggle/macro/Cargo.toml`.

Fixes #8563.

4 years agoProperly set for_host for proc-macro tests.
Eric Huss [Mon, 28 Sep 2020 23:21:55 +0000 (16:21 -0700)]
Properly set for_host for proc-macro tests.

4 years agoCorrect mistake about supporting sub-makes and document CARGO_MAKEFLAGS
est31 [Mon, 28 Sep 2020 21:10:10 +0000 (23:10 +0200)]
Correct mistake about supporting sub-makes and document CARGO_MAKEFLAGS

Sub-makes are currently not supported as the jobserver crate only
sets CARGO_MAKEFLAGS which GNU Make doesn't understand.

This might be reasonable as cargo overriding existing MAKEFLAGS
variables would be weird, but also makes the statement in the
reference false.

It's helpful for build script authors who want to invoke make
to know how to get make subprocesses work with parallel builds.

4 years agoAuto merge of #8740 - nop:target-completion, r=ehuss
bors [Mon, 28 Sep 2020 14:52:35 +0000 (14:52 +0000)]
Auto merge of #8740 - nop:target-completion, r=ehuss

Add Zsh completion for target triples

Target triples are used for specifying targets for e.g. `cargo build --target thumbv7em-none-eabihf` where `thumbv7em-none-eabihf` is the target triplet.
For more information on target triples, see <https://doc.rust-lang.org/cargo/appendix/glossary.html#target>.

4 years agoAdd Zsh completion for target triples
nop [Mon, 28 Sep 2020 07:08:19 +0000 (02:08 -0500)]
Add Zsh completion for target triples

Target triples are used for specifying targets for e.g. `cargo build
--target thumbv7em-none-eabihf` where `thumbv7em-none-eabihf` is the
target triplet.
For more information on target triples, see
<https://doc.rust-lang.org/cargo/appendix/glossary.html#target>.

4 years agoAuto merge of #8735 - ehuss:git-object-not-found, r=alexcrichton
bors [Sun, 27 Sep 2020 17:44:27 +0000 (17:44 +0000)]
Auto merge of #8735 - ehuss:git-object-not-found, r=alexcrichton

Reinitialize index on "Object not found" error.

Fixes #4007

Users have occasionally been reporting "Object not found" errors when updating the index. This PR changes cargo to detect this error, and delete the index and attempt one more time to update it.  Our best theory is that the git repo is getting corrupted or out-of-sync somehow.

**Other options**
We talked about having cargo generate a ZIP file of the corrupt repo and ask the user to upload it to the issue tracker, but I feel like that isn't going to be too useful (there will be an object missing in the repo, which is unlikely to tell us how to got lost).

We could also implement some tricks to make the fetch process more atomic (by renaming the git directory before starting the fetch), but I'm uncertain if the added complexity is justified.

Another option (which I personally like) is to use `net.git-fetch-with-cli` by default if `git` is found in `PATH`.  It is faster and more reliable and handles authentication better, and I suspect the vast majority of developer and CI systems have `git` installed.  This kinda sweeps the problems of libgit2 under the rug, and would mean a huge amount of code would no longer be exercised by most users, leaving the few without `git` to be more likely to suffer obscure bugs.

**Testing**
Note that I was unable to create a local test to reproduce this, but I was able to reproduce against GitHub.  I took my index repo and removed the most recent pack file, and then ran `cargo fetch`. This resulted in the exact same error users are reporting. I believe I cannot repro locally because the network update code is significantly different from the `file://` update code (there's all sorts of negotiation that happens over the protocol).  Unless anyone has ideas on how to repro this in an automated fashion, I'm out of ideas.

**Other corruption**
In testing, I noticed there are a few other ways the "Object not found" error can happen, but this does not address them. Both cases involved deleting pack files:

1. After deleting the oldest pack file in an index, running an update, the index fetch succeeds. But then, when the `RemoteRegistry` attempts to load the `config.json` file, it can't find it (it fails [here](https://github.com/rust-lang/cargo/blob/05c611ae3c4255b7a2bcf4fcfa65b20286a07839/src/cargo/sources/registry/remote.rs#L181)).

2. After deleting the newest pack file of a git dependency in the `db` directory, the fetch succeeds, but then the call to `reset` of the checkout fails (around [here](https://github.com/rust-lang/cargo/blob/05c611ae3c4255b7a2bcf4fcfa65b20286a07839/src/cargo/sources/git/utils.rs#L480)).

Fixing these I think will be require a bit of work, since retry loops will need to be added. I'm not too eager to do that since nobody has reported an error with either of these cases (the error stack is slightly different).

4 years agoAuto merge of #8739 - ehuss:normalize-raw-strings, r=alexcrichton
bors [Sun, 27 Sep 2020 08:48:55 +0000 (08:48 +0000)]
Auto merge of #8739 - ehuss:normalize-raw-strings, r=alexcrichton

Normalize raw string indentation.

It has always slightly bugged me how strings were indented after rustfmt was run across the repo (#5176). This attempts to normalize the strings so that they open and close on the same column.  This only touches the `tests` directory.

4 years agoAuto merge of #8738 - ehuss:rustup-links, r=alexcrichton
bors [Sun, 27 Sep 2020 08:23:38 +0000 (08:23 +0000)]
Auto merge of #8738 - ehuss:rustup-links, r=alexcrichton

Update links to rustup docs.

The rustup docs have moved, so update some of the documentation links.

4 years agoAuto merge of #8715 - ehuss:contrib, r=alexcrichton
bors [Sun, 27 Sep 2020 07:06:34 +0000 (07:06 +0000)]
Auto merge of #8715 - ehuss:contrib, r=alexcrichton

Add contributor guide.

This consolidates and extends the contributor information in a single place. This is an mdbook project, along with a CI job which will build and deploy it to GitHub Pages at <https://rust-lang.github.io/cargo/contrib/>.

You can view a rendered version here: <https://ehuss.github.io/cargo/contrib/>

I don't know if this will actually be helpful to anyone, but I figured it's worth a shot.

NOTE: The CI deploy is designed to preserve the existing gh-pages content.  However, it will **delete the history** on that branch. I think that should be fine, there doesn't seem to be too much interesting stuff there.  I do have a backup in my fork, though. Some extra scrutiny on the code might be wise.  The reason it deletes the history is because deploying mdbook on every push would balloon the repository size.

4 years agoAuto merge of #8737 - ehuss:doc-update-lockfile, r=alexcrichton
bors [Sun, 27 Sep 2020 06:39:39 +0000 (06:39 +0000)]
Auto merge of #8737 - ehuss:doc-update-lockfile, r=alexcrichton

Fix minor error in `cargo update` docs.

`cargo update` does not require `Cargo.lock` to exist.

Also updated `generate-lockfile` to maybe be a little clearer (to me).

4 years agoNormalize raw string indentation.
Eric Huss [Sun, 27 Sep 2020 00:59:58 +0000 (17:59 -0700)]
Normalize raw string indentation.

4 years agoUpdate links to rustup docs.
Eric Huss [Sat, 26 Sep 2020 17:09:04 +0000 (10:09 -0700)]
Update links to rustup docs.

4 years agoFix minor error in `cargo update` docs.
Eric Huss [Sat, 26 Sep 2020 16:59:43 +0000 (09:59 -0700)]
Fix minor error in `cargo update` docs.

4 years agoNumber the subcommand steps.
Eric Huss [Sat, 26 Sep 2020 16:13:04 +0000 (09:13 -0700)]
Number the subcommand steps.

4 years agoAdd introduction to the architecture chapter.
Eric Huss [Sat, 26 Sep 2020 16:12:06 +0000 (09:12 -0700)]
Add introduction to the architecture chapter.

4 years agoReinitialize index on "Object not found" error.
Eric Huss [Fri, 25 Sep 2020 20:44:49 +0000 (13:44 -0700)]
Reinitialize index on "Object not found" error.

4 years agoAuto merge of #8712 - dtolnay:workspace, r=ehuss
bors [Wed, 23 Sep 2020 23:10:38 +0000 (23:10 +0000)]
Auto merge of #8712 - dtolnay:workspace, r=ehuss

--workspace flag for locate-project to find the workspace root

<pre>
<i>/git/serde/serde_derive</i>$ <b>cargo locate-project</b>
{"root":"<a href="https://github.com/serde-rs/serde/blob/master/serde_derive/Cargo.toml">/git/serde/serde_derive/Cargo.toml</a>"}

<i>/git/serde/serde_derive</i>$ <b>cargo locate-project --workspace</b>
{"root":"<a href="https://github.com/serde-rs/serde/blob/master/Cargo.toml">/git/serde/Cargo.toml</a>"}
</pre>

4 years ago--workspace flag for locate-project to find the workspace root
David Tolnay [Fri, 18 Sep 2020 03:38:54 +0000 (23:38 -0400)]
--workspace flag for locate-project to find the workspace root

4 years agoAuto merge of #8727 - ehuss:badges, r=alexcrichton
bors [Wed, 23 Sep 2020 22:32:22 +0000 (22:32 +0000)]
Auto merge of #8727 - ehuss:badges, r=alexcrichton

Remove some badges documentation.

Badges have been removed from crates.io, so this updates the documentation. I don't think Cargo should manage a schema for the different services, and since crates.io isn't using these, I think it is mostly a dead feature. I left the `maintenance` field, because that might still have some meaning in the future.

More details:
* Removal from crates.io: https://github.com/rust-lang/crates.io/issues/2436 https://github.com/rust-lang/crates.io/pull/2440
* Solicited feedback for this change: https://internals.rust-lang.org/t/cargo-badges/12982
* Potential future support of `maintenance` status: https://github.com/rust-lang/crates.io/issues/2437 https://github.com/rust-lang/crates.io/issues/2438 https://github.com/rust-lang/crates.io/pull/2439. It's not clear, if crates.io manages the status in the database, the motivation for putting it in `Cargo.toml` is probably pretty small.

4 years agoRemove some badges documentation.
Eric Huss [Wed, 23 Sep 2020 22:08:41 +0000 (15:08 -0700)]
Remove some badges documentation.

4 years agoAuto merge of #8707 - dtolnay:plain, r=ehuss
bors [Wed, 23 Sep 2020 21:51:43 +0000 (21:51 +0000)]
Auto merge of #8707 - dtolnay:plain, r=ehuss

Add plain message format for locate-project

Supersedes #8683, as recommended in https://github.com/rust-lang/cargo/pull/8683#issuecomment-692921559. This PR adds a flag `--message-format` to `cargo locate-project` with possible values `json` (default) and `plain`.

```console
$ cargo locate-project --message-format json
{"root":"/git/cargo/Cargo.toml"}

$ cargo locate-project --message-format plain
/git/cargo/Cargo.toml
```

Closes #8009.

4 years agoAuto merge of #8165 - mchernyavsky:force-progress, r=ehuss
bors [Wed, 23 Sep 2020 21:28:14 +0000 (21:28 +0000)]
Auto merge of #8165 - mchernyavsky:force-progress, r=ehuss

Add a term option to configure the progress bar

Closes https://github.com/rust-lang/cargo/issues/7587.

4 years agoAuto merge of #8721 - est31:ns, r=ehuss
bors [Sun, 20 Sep 2020 14:14:41 +0000 (14:14 +0000)]
Auto merge of #8721 - est31:ns, r=ehuss

Replace d_as_f64 with as_secs_f64

4 years agoReplace d_as_f64 with as_secs_f64
est31 [Sun, 20 Sep 2020 08:24:24 +0000 (10:24 +0200)]
Replace d_as_f64 with as_secs_f64

4 years agoAdd contributor guide.
Eric Huss [Fri, 18 Sep 2020 20:17:58 +0000 (13:17 -0700)]
Add contributor guide.

4 years agoAuto merge of #8713 - ehuss:filters_target-cross, r=alexcrichton
bors [Fri, 18 Sep 2020 19:31:59 +0000 (19:31 +0000)]
Auto merge of #8713 - ehuss:filters_target-cross, r=alexcrichton

Add cross check to filters_target test.

This test requires a cross compiler target to be installed, so disable it if it is not.

4 years agoAdd cross check to filters_target test.
Eric Huss [Fri, 18 Sep 2020 19:28:33 +0000 (12:28 -0700)]
Add cross check to filters_target test.

4 years agoAdd plain message format for locate-project
David Tolnay [Wed, 16 Sep 2020 05:50:15 +0000 (01:50 -0400)]
Add plain message format for locate-project

4 years agoAdd a term option to configure the progress bar
mchernyavsky [Sat, 12 Sep 2020 17:15:47 +0000 (20:15 +0300)]
Add a term option to configure the progress bar

4 years agoAuto merge of #8706 - ehuss:flag-whitespace-test, r=alexcrichton
bors [Tue, 15 Sep 2020 22:24:02 +0000 (22:24 +0000)]
Auto merge of #8706 - ehuss:flag-whitespace-test, r=alexcrichton

Add test for whitespace behavior in env flags.

This is a regression test to ensure that RUSTFLAGS/RUSTDOCFLAGS are split on just the space (0x20) character, and not any other whitespace. Requested at https://github.com/rust-lang/rust/pull/75539/files#r470923329

4 years agoAdd test for whitespace behavior in env flags.
Eric Huss [Tue, 15 Sep 2020 21:22:19 +0000 (14:22 -0700)]
Add test for whitespace behavior in env flags.

4 years agoAuto merge of #8697 - Mikastiv:pr-8695, r=ehuss
bors [Tue, 15 Sep 2020 19:11:03 +0000 (19:11 +0000)]
Auto merge of #8697 - Mikastiv:pr-8695, r=ehuss

updated yank error message

Fixes #8695

4 years agoAuto merge of #8701 - ehuss:unique-unit-dep-hash, r=alexcrichton
bors [Mon, 14 Sep 2020 19:14:33 +0000 (19:14 +0000)]
Auto merge of #8701 - ehuss:unique-unit-dep-hash, r=alexcrichton

Fix non-determinism with new feature resolver.

This fixes a problem where Cargo was getting confused when two units were identical, but linked to different dependencies. Cargo generally assumes `Unit` is unique, but the new feature resolver can introduce a situation where two identical `Unit`s need to link to different dependencies. In particular, when building without the `--target` flag, the difference between a host unit and a target unit is not captured in the `Unit` structure. A dependency shared between normal dependencies and build dependencies can need to link to a second shared dependency whose features may be different.

The solution here is to build the unit graph pretending that `--target` was specified. Then, after the graph has been built, a second pass replaces `CompileKind::Target(host)` with `CompileKind::Host`, and adds a hash of the dependencies to the `Unit` to ensure it stays unique when necessary. This is done to ensure that dependencies are shared if possible.

I did a little performance testing, and I couldn't measure an appreciable difference. I also ran the tests in a loop for a few hours without problems.

An alternate solution here is to assume `--target=host` if `--target` isn't specified, and then have some kind of backwards-compatible linking in the `target` directory to retain the old directory layout. However, this would result in building shared host/normal dependencies twice. For *most* projects, this isn't a problem. This already happens when `--target` is specified, or `--release` is used (due to #8500). I'm just being very cautious because in a few projects this can be a large increase in build times. Maybe some day in the future we can be more bold and force this division, but I'm a little hesitant to make that jump.

Fixes #8549

4 years agoFix non-determinism with new feature resolver.
Eric Huss [Sat, 12 Sep 2020 20:43:04 +0000 (13:43 -0700)]
Fix non-determinism with new feature resolver.

4 years ago--vers arg now required for yank cmd
Mikastiv [Sat, 12 Sep 2020 21:13:13 +0000 (17:13 -0400)]
--vers arg now required for yank cmd

4 years agoAuto merge of #8692 - yaymukund:improve-tests-json-diffing, r=alexcrichton
bors [Sat, 12 Sep 2020 16:39:05 +0000 (16:39 +0000)]
Auto merge of #8692 - yaymukund:improve-tests-json-diffing, r=alexcrichton

Display formatted output for JSON diffing in tests.

This affects all tests that use `validate_upload`.

Before
<img src="https://user-images.githubusercontent.com/590450/92583169-da972000-f289-11ea-9f27-f09071a023b1.png" width="400">

After
<img src="https://user-images.githubusercontent.com/590450/92583195-e2ef5b00-f289-11ea-9ee5-a32f630a6472.png" width="400">

4 years agoDisplay formatted output for JSON diffing in tests.
Mukund Lakshman [Wed, 9 Sep 2020 09:23:06 +0000 (10:23 +0100)]
Display formatted output for JSON diffing in tests.

4 years agoupdated yank error message
Mikastiv [Thu, 10 Sep 2020 20:11:41 +0000 (16:11 -0400)]
updated yank error message

4 years agoAuto merge of #8675 - weihanglo:fix/name-help, r=Eh2406
bors [Thu, 10 Sep 2020 19:06:19 +0000 (19:06 +0000)]
Auto merge of #8675 - weihanglo:fix/name-help, r=Eh2406

Add --name suggestion for cargo new

Resolves #8613

Since `check_name` have already got a parameter to show name help, I reuse the logic and sync the behavior between `cargo init` and `cargo new`. The divergence seems to be intentionally made in #7959:

_...Only print the --name suggestion for `cargo init`._

Feel free to discuss.

4 years agoAuto merge of #8681 - weihanglo:fix/redundant-messsage-local-crate-install, r=ehuss
bors [Thu, 10 Sep 2020 18:40:48 +0000 (18:40 +0000)]
Auto merge of #8681 - weihanglo:fix/redundant-messsage-local-crate-install, r=ehuss

Sweep unrelated message from unnecessary workspace infromation

Resolves #8619

Only pass workspace information when the source is from a local crate installation.

4 years agoFix unintenional newline in stderr assertion
Weihang Lo [Thu, 10 Sep 2020 17:02:59 +0000 (01:02 +0800)]
Fix unintenional newline in stderr assertion

4 years agoRephrase message of restricted crate name
Weihang Lo [Thu, 10 Sep 2020 12:52:43 +0000 (20:52 +0800)]
Rephrase message of restricted crate name

4 years agotest: check stderr containment explicitly
Weihang Lo [Wed, 9 Sep 2020 23:57:57 +0000 (07:57 +0800)]
test: check stderr containment explicitly

4 years agoAuto merge of #8666 - clemens-tolboom:patch-1, r=Eh2406
bors [Wed, 9 Sep 2020 21:59:25 +0000 (21:59 +0000)]
Auto merge of #8666 - clemens-tolboom:patch-1, r=Eh2406

Docs: Make it more clear we have two types of workspaces

It needed a few rereads before I discovered the two flavours. Hope this helps.

4 years agoFix formatting
Weihang Lo [Wed, 9 Sep 2020 16:26:06 +0000 (00:26 +0800)]
Fix formatting

4 years agoTest for crate installation without emitting messages from cwd
Weihang Lo [Wed, 9 Sep 2020 16:20:00 +0000 (00:20 +0800)]
Test for crate installation without emitting messages from cwd

4 years agoAuto merge of #8655 - camelid:patch-1, r=ehuss
bors [Tue, 8 Sep 2020 20:17:21 +0000 (20:17 +0000)]
Auto merge of #8655 - camelid:patch-1, r=ehuss

Lowercase and remove periods in error messages for consistency

4 years agoUpdate tests
Camelid [Mon, 7 Sep 2020 17:57:00 +0000 (10:57 -0700)]
Update tests

4 years agoAuto merge of #8682 - dtolnay:build-man, r=ehuss
bors [Sun, 6 Sep 2020 19:38:33 +0000 (19:38 +0000)]
Auto merge of #8682 - dtolnay:build-man, r=ehuss

Allow running build-man.sh from any directory

Before:

```console
$ src/doc/build-man.sh
error: manifest path `../../crates/mdman/Cargo.toml` does not exist
```

After: works.

4 years agoAllow running build-man.sh from any directory
David Tolnay [Sun, 6 Sep 2020 19:09:07 +0000 (12:09 -0700)]
Allow running build-man.sh from any directory

Before:

    $ src/doc/build-man.sh
    error: manifest path `../../crates/mdman/Cargo.toml` does not exist

After: works.

4 years agoOnly `--path` and cwd crate installation need workspace info
Weihang Lo [Sun, 6 Sep 2020 11:24:15 +0000 (19:24 +0800)]
Only `--path` and cwd crate installation need workspace info

4 years agoSweep unrelated message from unnecessary workspace infromation
Weihang Lo [Sun, 6 Sep 2020 05:29:52 +0000 (13:29 +0800)]
Sweep unrelated message from unnecessary workspace infromation

4 years agoAuto merge of #8677 - Rustin-Liu:rustin-patch-docs, r=ehuss
bors [Sat, 5 Sep 2020 18:45:58 +0000 (18:45 +0000)]
Auto merge of #8677 - Rustin-Liu:rustin-patch-docs, r=ehuss

docs: add details for cargo check pass where cargo build fail

close  #8650

4 years agoAuto merge of #8678 - ehuss:fix-priv-test, r=alexcrichton
bors [Sat, 5 Sep 2020 17:44:58 +0000 (17:44 +0000)]
Auto merge of #8678 - ehuss:fix-priv-test, r=alexcrichton

Fix nightly exported_priv_warning test.

Error messages have slightly changed due to https://github.com/rust-lang/rust/pull/73996 to not include the full path.  I used a `[..]` match just in case anyone is still using a slightly older nightly, or if it changes again in the future.

4 years agoFix nightly exported_priv_warning test.
Eric Huss [Sat, 5 Sep 2020 17:31:04 +0000 (10:31 -0700)]
Fix nightly exported_priv_warning test.

4 years agodocs: add details for cargo check pass where cargo build fail
Rustin-Liu [Sat, 5 Sep 2020 03:17:06 +0000 (11:17 +0800)]
docs: add details for cargo check pass where cargo build fail

4 years agoAuto merge of #8674 - guswynn:mdbooktest, r=ehuss
bors [Fri, 4 Sep 2020 13:55:31 +0000 (13:55 +0000)]
Auto merge of #8674 - guswynn:mdbooktest, r=ehuss

fix mdbook test with ```ignore/text/sh/console

I revitalized the dead PR #7832

sorry about the delay

testing is just running `mdbook test` which now passes! Let me know if you want me to add mdbook test to ci as well!

4 years agofix mdbook test with ```ignore
Gus Wynn [Sat, 25 Jan 2020 23:40:00 +0000 (15:40 -0800)]
fix mdbook test with ```ignore

4 years agoFix test for windows reserved filename error message
Weihang Lo [Fri, 4 Sep 2020 01:18:47 +0000 (09:18 +0800)]
Fix test for windows reserved filename error message

4 years agoTest for --name hint
Weihang Lo [Fri, 4 Sep 2020 00:39:13 +0000 (08:39 +0800)]
Test for --name hint

4 years agoAdd --name hint for `new` when package name is retricted
Weihang Lo [Thu, 3 Sep 2020 17:27:46 +0000 (01:27 +0800)]
Add --name hint for `new` when package name is retricted

4 years agoAuto merge of #8672 - dtolnay:cachedir, r=alexcrichton
bors [Tue, 1 Sep 2020 22:14:09 +0000 (22:14 +0000)]
Auto merge of #8672 - dtolnay:cachedir, r=alexcrichton

End CACHEDIR.TAG with newline

Before:

```
/path/to$  cat target/CACHEDIR.TAG
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by cargo.
# For information about cache directory tags see https://bford.info/cachedir//path/to$  ▎
```

After:

```
/path/to$  cat target/CACHEDIR.TAG
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by cargo.
# For information about cache directory tags see https://bford.info/cachedir/
/path/to$  ▎
```

4 years agoAuto merge of #8671 - pjmore:master, r=alexcrichton
bors [Tue, 1 Sep 2020 21:52:17 +0000 (21:52 +0000)]
Auto merge of #8671 - pjmore:master, r=alexcrichton

Fixed the fossil repo initialization actually run commands

I noticed that when using fossil cargo new would not ignore the target directory and that the commands to do so weren't being executed. I wasn't sure if opening an issue was needed as the fix is extremely simple, if an issue is needed I can create one.

4 years agoEnd CACHEDIR.TAG with newline
David Tolnay [Tue, 1 Sep 2020 20:05:05 +0000 (13:05 -0700)]
End CACHEDIR.TAG with newline

4 years agoModified the fossil repo initialization function to run the commands to
Patrick More [Tue, 1 Sep 2020 18:56:36 +0000 (11:56 -0700)]
Modified the fossil repo initialization function to run the commands to
set the target directory as ignoreable and cleanable.

4 years agoAuto merge of #8670 - ehuss:remove-asciidoc-attribute, r=Eh2406
bors [Tue, 1 Sep 2020 18:30:39 +0000 (18:30 +0000)]
Auto merge of #8670 - ehuss:remove-asciidoc-attribute, r=Eh2406

Remove asciidoc attribute in cargo-metadata man page.

I accidentally left this behind during #8577.

4 years agoRemove asciidoc attribute
Eric Huss [Tue, 1 Sep 2020 17:46:45 +0000 (10:46 -0700)]
Remove asciidoc attribute

4 years agoAuto merge of #8668 - alexcrichton:fix-close-output, r=ehuss
bors [Mon, 31 Aug 2020 20:42:11 +0000 (20:42 +0000)]
Auto merge of #8668 - alexcrichton:fix-close-output, r=ehuss

Fix flakiness in close_output test

It looks like stdout/stderr can race as to which gets printed first, but
both are valid for this test.

Closes #8665

4 years agoFix flakiness in close_output test
Alex Crichton [Mon, 31 Aug 2020 20:15:02 +0000 (13:15 -0700)]
Fix flakiness in close_output test

It looks like stdout/stderr can race as to which gets printed first, but
both are valid for this test.

Closes #8665

4 years agoMake it more clear we have two types of workspaces
Clemens Tolboom [Mon, 31 Aug 2020 15:15:35 +0000 (17:15 +0200)]
Make it more clear we have two types of workspaces

It needed a few rereads before I discovered the two flavours. Hope this helps.

4 years agoAuto merge of #8656 - phil-opp:fix-8512, r=ehuss
bors [Mon, 31 Aug 2020 15:01:14 +0000 (15:01 +0000)]
Auto merge of #8656 - phil-opp:fix-8512, r=ehuss

Reload unstable table from config file in `reload_rooted_at`

Fixes #8512

cc @ehuss

4 years agoAuto merge of #8659 - ehuss:version-bump, r=alexcrichton
bors [Fri, 28 Aug 2020 19:59:18 +0000 (19:59 +0000)]
Auto merge of #8659 - ehuss:version-bump, r=alexcrichton

Bump to 0.49.0, update changelog

4 years agoUpdate changelog for 1.47
Eric Huss [Fri, 28 Aug 2020 18:08:37 +0000 (11:08 -0700)]
Update changelog for 1.47

4 years agoBump to 0.49.0
Eric Huss [Fri, 28 Aug 2020 17:17:49 +0000 (10:17 -0700)]
Bump to 0.49.0

4 years agoAuto merge of #8657 - ehuss:fix-doctest-lto, r=alexcrichton
bors [Fri, 28 Aug 2020 15:39:13 +0000 (15:39 +0000)]
Auto merge of #8657 - ehuss:fix-doctest-lto, r=alexcrichton

Fix LTO with doctests.

This fixes an issue where `cargo test --release` would fail to run doctests if LTO is set in `profile.release` or `profile.bench`.

The issue is that dependencies were built with `-Clinker-plugin-lto`, but the final rustdoc invocation did not issue `-C lto`. This causes a link failure (or crash!) because the necessary object code was missing.  This is because rustdoc historically did not support codegen flags, so Cargo has never passed them in.  Rustdoc now supports codegen flags (via https://github.com/rust-lang/rust/pull/63827), so it should be safe to start passing them in.  For now, I am only adding LTO, but more should be added in the future.

There are two bugs here. One is that LTO flags aren't passed to rustdoc. The other is that the "doctest" unit was using the wrong profile (it was using dev/release when it should be using test/bench).

There are two distinct scenarios here.  One where just `release` has `lto` set.  And one where both `release` and `bench` have `lto` set.  This is relevant because LTO mostly cares about what the final artifact wants, and in the case where `bench` does not have `lto` set, then LTO will not be used for tests. This will hopefully be a little cleaner in the future when #6988 is stabilized, which causes the test/bench profiles to *inherit* from the dev/bench profiles, which means you won't need to manually synchronize the test/bench profiles with dev/release.

Fixes #8654

4 years agoFix LTO with doctests.
Eric Huss [Thu, 27 Aug 2020 23:41:43 +0000 (16:41 -0700)]
Fix LTO with doctests.

4 years agoReload unstable table from config file in `reload_rooted_at`
Philipp Oppermann [Thu, 27 Aug 2020 08:51:43 +0000 (10:51 +0200)]
Reload unstable table from config file in `reload_rooted_at`

4 years agoRemove periods from error messages
Camelid [Thu, 27 Aug 2020 02:51:53 +0000 (19:51 -0700)]
Remove periods from error messages

4 years agoLowercase docs error message for consistency
Camelid [Thu, 27 Aug 2020 01:51:36 +0000 (18:51 -0700)]
Lowercase docs error message for consistency

4 years agoAuto merge of #8648 - Fogapod:rustc-args, r=ehuss
bors [Wed, 26 Aug 2020 21:38:52 +0000 (21:38 +0000)]
Auto merge of #8648 - Fogapod:rustc-args, r=ehuss

Add spaces after -C and -Z flags for consistency

Most other options have a space after flag name.
This commit makes verbose output of rustc invocations a little bit cleaner.

4 years agoAuto merge of #8653 - ehuss:fix-cache-messages-rustdoc-test, r=alexcrichton
bors [Wed, 26 Aug 2020 18:59:57 +0000 (18:59 +0000)]
Auto merge of #8653 - ehuss:fix-cache-messages-rustdoc-test, r=alexcrichton

Fix cache_messages::rustdoc test broken on beta.

The most recent beta `rustc 1.47.0-beta.1` broke this test (https://github.com/rust-lang/rust/issues/75951).  Just switch to a different lint to get the test working again.

4 years agoFix cache_messages::rustdoc test broken on beta.
Eric Huss [Wed, 26 Aug 2020 18:17:57 +0000 (11:17 -0700)]
Fix cache_messages::rustdoc test broken on beta.

4 years agoAdd spaces after -C and -Z flags for consistency
Eugene [Tue, 25 Aug 2020 13:05:25 +0000 (16:05 +0300)]
Add spaces after -C and -Z flags for consistency
Most other options have a space after flag name.
This commit makes verbose output of rustc invocations a little bit cleaner.

4 years agoAuto merge of #8641 - weihanglo:fix/remove-alloc, r=Eh2406
bors [Sun, 23 Aug 2020 13:07:55 +0000 (13:07 +0000)]
Auto merge of #8641 - weihanglo:fix/remove-alloc, r=Eh2406

fix: remove unnecessary allocations

Remove unnecessary `str::to_string` and `str::replace` allocations by using iterators. This PR is almost identical to #8622 except it does not skip the generated header.

Sorry that I did not profile the changes by myself. Seems that valgrind does not support macOS 10.15.6, I have not idea how to profile cargo subcommand. It would be great for an instruction to run a memory profiling for Rust program on macOS.

4 years agorefactor: compare lockfile use Iterator.eq
Weihang Lo [Sun, 23 Aug 2020 01:07:54 +0000 (09:07 +0800)]
refactor: compare lockfile use Iterator.eq

4 years agofix: remove unnecessary allocations
Weihang Lo [Sun, 23 Aug 2020 00:19:16 +0000 (08:19 +0800)]
fix: remove unnecessary allocations

4 years agoAuto merge of #8637 - hbina:spelling_and_clippy, r=alexcrichton
bors [Thu, 20 Aug 2020 17:29:36 +0000 (17:29 +0000)]
Auto merge of #8637 - hbina:spelling_and_clippy, r=alexcrichton

Fixed a spelling and some clippy warnings

4 years agoFixed a spelling and some clippy warnings
Hanif Bin Ariffin [Wed, 19 Aug 2020 22:20:51 +0000 (18:20 -0400)]
Fixed a spelling and some clippy warnings

4 years agoAuto merge of #8609 - ehuss:resolver-semver, r=Eh2406
bors [Wed, 19 Aug 2020 20:22:52 +0000 (20:22 +0000)]
Auto merge of #8609 - ehuss:resolver-semver, r=Eh2406

Add chapters on dependency resolution and SemVer compatibility.

This adds two documentation chapters, one on the resolver and one on SemVer compatibility. These are intended to help guide users on how to version their package and how to use dependencies.

I did not document `[patch]` resolution. Perhaps someday in the future the the "Overriding dependencies" chapter can be expanded to include more details on how patch works, and how to properly use it. I have a bunch of notes on this, but I want to defer it till later.

The SemVer compatibility guidelines were guided by [RFC 1105](https://github.com/rust-lang/rfcs/blob/master/text/1105-api-evolution.md), but are edited and expanded based on my own personal observations. I tried to highlight when some rules do not appear to have consensus on behavior. I would be happy for any additions or modifications to the rule list. I have a list of additional things to add, but I wanted to get the ball rolling, and it might take a while finish them.

Each compatibility entry has an example, and there is a small script which tests all the examples to ensure they work like they are supposed to. This script checks against the compiler output, which can be fragile over time. If that becomes too troublesome, we can probably find some more relaxed checks. I think checking the error is important because I've run into cases in the past where using basic "compile_fail" annotations were misleading because the examples were failing for the wrong reason.

Closes #7301

4 years agoAuto merge of #8611 - hbina:rename_into_url, r=ehuss
bors [Wed, 19 Aug 2020 19:30:21 +0000 (19:30 +0000)]
Auto merge of #8611 - hbina:rename_into_url, r=ehuss

Renames SourceId::into_url -> SourceId::as_url

While studying the source code, I am surprised to see that `into_url`
does not actually consume its caller when a function with such name
usually does. Additionally, there is a trait in `cargo::util::IntoUrl`
with the same and does exactly what you expect, consumes itself and yields
a `CargoResult<Url>`.

I hope this is not too nitpicky.
Thank you!

4 years agoAuto merge of #8629 - EmbarkStudios:master, r=ehuss
bors [Tue, 18 Aug 2020 16:52:45 +0000 (16:52 +0000)]
Auto merge of #8629 - EmbarkStudios:master, r=ehuss

Fix bug with PathAndArg config values

This fixes an issue I noticed when trying to specify a target runner via the [`CARGO_TARGET_{triplet}_RUNNER`](https://doc.rust-lang.org/cargo/reference/config.html#targettriplerunner) environment variable, expecting it to override the value in our `.cargo/config.toml` file, which was giving quite strange errors until I figured out that cargo was actually merging the config file's values with the environment's values.

This change adds a small hack to use and `UnmergedStringList` from `PathAndArgs` instead of just plain `StringList`, which uses the type in the deserializer to determine if `Config::get_list_or_string` should merge the values from the config file(s) with the environment as it was doing before, or else only use the environment to the exclusion of the config file(s) if the key was set in the environment.

I also added a test for this to confirm both the bug and the fix.