]> git.proxmox.com Git - cargo.git/log
cargo.git
3 years agofix: set search path before init repos
Weihang Lo [Fri, 1 Jan 2021 14:07:34 +0000 (22:07 +0800)]
fix: set search path before init repos

3 years agoAuto merge of #9026 - kassens:master, r=Eh2406
bors [Tue, 29 Dec 2020 17:55:07 +0000 (17:55 +0000)]
Auto merge of #9026 - kassens:master, r=Eh2406

Clarify fingerprint log messages

I had to look up the source to figure out which side was the old value for a RUSTFLAGS fingerprint mismatch.

Making the logs a bit more explicit about which value is old and new would've helped me.

3 years agocargo fmt
Jan Kassens [Tue, 29 Dec 2020 17:42:28 +0000 (12:42 -0500)]
cargo fmt

3 years agoClarify fingerprint log messages
Jan Kassens [Tue, 29 Dec 2020 17:29:15 +0000 (17:29 +0000)]
Clarify fingerprint log messages

3 years agoAuto merge of #9013 - ehuss:credential-install-gnome-secret, r=Eh2406
bors [Thu, 24 Dec 2020 01:51:32 +0000 (01:51 +0000)]
Auto merge of #9013 - ehuss:credential-install-gnome-secret, r=Eh2406

Update credential docs for gnome-secret.

This can now be installed directly from crates.io, which is generally much faster than git.

3 years agoUpdate credential docs for gnome-secret.
Eric Huss [Thu, 24 Dec 2020 01:43:28 +0000 (17:43 -0800)]
Update credential docs for gnome-secret.

This can now be installed directly from crates.io, which is generally
much faster than git.

3 years agoAuto merge of #9009 - ehuss:bump-git2, r=alexcrichton
bors [Tue, 22 Dec 2020 18:10:56 +0000 (18:10 +0000)]
Auto merge of #9009 - ehuss:bump-git2, r=alexcrichton

Update git2

Pulls in https://github.com/rust-lang/git2-rs/pull/646 fixing an issue with arm64.

3 years agoUpdate git2
Eric Huss [Tue, 22 Dec 2020 14:03:54 +0000 (06:03 -0800)]
Update git2

3 years agoAuto merge of #8976 - ebroto:rustc_workspace_wrapper, r=ehuss
bors [Mon, 21 Dec 2020 19:37:30 +0000 (19:37 +0000)]
Auto merge of #8976 - ebroto:rustc_workspace_wrapper, r=ehuss

Stabilize RUSTC_WORKSPACE_WRAPPER

Stabilizing this environment variable would allow Clippy to fix a long-standing usability problem, [clippy#4612](https://github.com/rust-lang/rust-clippy/issues/4612).

It's also the last step towards stabilizing the `--fix` command-line argument in Clippy, that allows applying suggestions automatically when the lint supports it.

Closes #8143

r? `@ehuss`

3 years agoAuto merge of #8987 - jonhoo:metadata-target-filtering, r=ehuss
bors [Sat, 19 Dec 2020 15:23:22 +0000 (15:23 +0000)]
Auto merge of #8987 - jonhoo:metadata-target-filtering, r=ehuss

Make cargo metadata and tree respect target

Previously, the `metadata` and `tree` subcommands would download
dependencies for all targets, regardless of whether those targets were
actually enabled. This PR updates them so that they only download the
same dependencies that building would do with the requested target(s).

`cargo metadata` still includes all targets by default; you can only opt
_out_ using `--filter-platform`. Ideally it should use `--target` the
same way `tree` does, but it's too late to change that now.

Fixes #8981.

3 years agoAuto merge of #8998 - ehuss:update-git2, r=alexcrichton
bors [Fri, 18 Dec 2020 19:22:18 +0000 (19:22 +0000)]
Auto merge of #8998 - ehuss:update-git2, r=alexcrichton

Update git2

Hopefully this will finally fix #8517 (and hopefully won't cause much breakage).

Major changes:
- Requires libgit2 1.1: https://github.com/rust-lang/git2-rs/pull/632
- Update libgit2: https://github.com/rust-lang/git2-rs/pull/642  (changes: https://github.com/libgit2/libgit2/compare/7f4fa178629d559c037a1f72f79f79af9c1ef8ce...530d37beb2731a2073f5298242825a803815c37c)

3 years agoAuto merge of #8996 - alexcrichton:revert, r=ehuss
bors [Fri, 18 Dec 2020 18:21:58 +0000 (18:21 +0000)]
Auto merge of #8996 - alexcrichton:revert, r=ehuss

Revert #8954 - changing rustdoc's cwd

This PR reverts https://github.com/rust-lang/cargo/pull/8954 in reference to https://github.com/rust-lang/cargo/issues/8993 and https://github.com/rust-lang/cargo/issues/8992 where there's still definitely a bug to be fixed but we should probably avoid regressing in the meantime.

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

3 years agoUpdate git2
Eric Huss [Fri, 18 Dec 2020 18:13:50 +0000 (10:13 -0800)]
Update git2

3 years agoRevert now-unnecessary change
Jon Gjengset [Fri, 18 Dec 2020 18:06:36 +0000 (10:06 -0800)]
Revert now-unnecessary change

3 years agoRemove unnecessary second download phase
Jon Gjengset [Fri, 18 Dec 2020 17:49:22 +0000 (09:49 -0800)]
Remove unnecessary second download phase

3 years agoRevert "Run rustdoc doctests relative to the workspace"
Alex Crichton [Fri, 18 Dec 2020 16:06:43 +0000 (08:06 -0800)]
Revert "Run rustdoc doctests relative to the workspace"

This reverts commit 2cc2ae8c963298143b71dceab0014dc09d4f65a8.

3 years agoRevert "fix failures on linux"
Alex Crichton [Fri, 18 Dec 2020 16:06:38 +0000 (08:06 -0800)]
Revert "fix failures on linux"

This reverts commit e729880f566839824d077d1be865ac5687fe0fdd.

3 years agoTrigger CI yet again for spurious failure.
Jon Gjengset [Thu, 17 Dec 2020 18:22:27 +0000 (10:22 -0800)]
Trigger CI yet again for spurious failure.

3 years agoRe-trigger CI for spurious failure.
Jon Gjengset [Thu, 17 Dec 2020 18:21:09 +0000 (10:21 -0800)]
Re-trigger CI for spurious failure.

3 years agoMake ResolveOpts::new take RequestedFeatures
Jon Gjengset [Thu, 17 Dec 2020 18:16:26 +0000 (10:16 -0800)]
Make ResolveOpts::new take RequestedFeatures

3 years agoAdd tests for fixed metadata download behavior
Jon Gjengset [Thu, 17 Dec 2020 18:01:24 +0000 (10:01 -0800)]
Add tests for fixed metadata download behavior

3 years agoAuto merge of #8991 - alexcrichton:debug-curl-verison, r=Eh2406
bors [Thu, 17 Dec 2020 16:18:33 +0000 (16:18 +0000)]
Auto merge of #8991 - alexcrichton:debug-curl-verison, r=Eh2406

With debug HTTP mode log curl's version

This will hopefully help any future reports where we're trying to
figure out what's going on with possible different versions of the
`curl` library.

3 years agoWith debug HTTP mode log curl's version
Alex Crichton [Thu, 17 Dec 2020 16:11:50 +0000 (08:11 -0800)]
With debug HTTP mode log curl's version

This will hopefully help any future reports where we're trying to
figure out what's going on with possible different versions of the
`curl` library.

3 years agoMake cargo metadata and tree respect target
Jon Gjengset [Wed, 16 Dec 2020 20:16:07 +0000 (12:16 -0800)]
Make cargo metadata and tree respect target

Previously, the `metadata` and `tree` subcommands would download
dependencies for all targets, regardless of whether those targets were
actually enabled. This PR updates them so that they only download the
same dependencies that building would do with the requested target(s).

`cargo metadata` still includes all targets by default; you can only opt
_out_ using `--filter-platform`. Ideally it should use `--target` the
same way `tree` does, but it's too late to change that now.

Fixes #8981.

3 years agoAuto merge of #8984 - ehuss:reject-ambiguous-git, r=Eh2406
bors [Wed, 16 Dec 2020 21:37:20 +0000 (21:37 +0000)]
Auto merge of #8984 - ehuss:reject-ambiguous-git, r=Eh2406

Reject ambiguous git dependency declaration.

This rejects a git dependency that specifies more than one of `branch`, `tag`, or `rev`. Cargo does not handle this case very well, and this warning has been in place for 4 years (since #2940).

Fixes #7841

3 years agoReject ambiguous git dependency declaration.
Eric Huss [Wed, 16 Dec 2020 21:10:11 +0000 (13:10 -0800)]
Reject ambiguous git dependency declaration.

3 years agoAuto merge of #8982 - ehuss:fix-alt-target-tests, r=alexcrichton
bors [Wed, 16 Dec 2020 21:02:59 +0000 (21:02 +0000)]
Auto merge of #8982 - ehuss:fix-alt-target-tests, r=alexcrichton

Fix tests not working with a different CARGO_TARGET_DIR.

Fixes #8980

3 years agoAuto merge of #8983 - ehuss:credential-versions, r=alexcrichton
bors [Wed, 16 Dec 2020 20:30:29 +0000 (20:30 +0000)]
Auto merge of #8983 - ehuss:credential-versions, r=alexcrichton

Add version to credential dependencies.

I forgot to add the version in the dependency declaration for cargo-credential.

3 years agoAdd version to credential dependencies.
Eric Huss [Wed, 16 Dec 2020 20:25:59 +0000 (12:25 -0800)]
Add version to credential dependencies.

I forgot to add the version in the dependency declaration for cargo-credential.

3 years agoFix tests not working with a different CARGO_TARGET_DIR.
Eric Huss [Wed, 16 Dec 2020 19:19:32 +0000 (11:19 -0800)]
Fix tests not working with a different CARGO_TARGET_DIR.

3 years agoAuto merge of #8978 - joshtriplett:faq-clarification, r=Eh2406
bors [Wed, 16 Dec 2020 14:35:53 +0000 (14:35 +0000)]
Auto merge of #8978 - joshtriplett:faq-clarification, r=Eh2406

Clarify FAQ entry wording about lockfiles

I received a report that this FAQ entry (and in particular the wording
"across whatever machine") generated some confusion. Reword the FAQ
entry for clarity.

3 years agoClarify FAQ entry wording about lockfiles
Josh Triplett [Wed, 16 Dec 2020 03:38:26 +0000 (19:38 -0800)]
Clarify FAQ entry wording about lockfiles

I received a report that this FAQ entry (and in particular the wording
"across whatever machine") generated some confusion. Reword the FAQ
entry for clarity.

3 years agoAuto merge of #8973 - ehuss:rerun-if-directory, r=alexcrichton
bors [Mon, 14 Dec 2020 17:21:26 +0000 (17:21 +0000)]
Auto merge of #8973 - ehuss:rerun-if-directory, r=alexcrichton

Check if rerun-if-changed points to a directory.

This changes it so that if a build script emits `cargo:rerun-if-changed` pointing to a directory, then Cargo will scan the entire directory for changes (instead of just looking at the mtime of the directory itself).  I think this is more useful, as otherwise build scripts have to recreate this logic.

I've tried to make it semi-intelligent in the face of symbolic links.  It checks the mtime of the link and its target, and follows the link if it points to a directory.

There are a few other edge cases. For example, if it doesn't have permission for a directory, it will skip it.  I think this is relatively reasonable, though it's hard to say for sure.

3 years agomtime_recursive: Add some comments and debugging diagnostics.
Eric Huss [Mon, 14 Dec 2020 16:55:10 +0000 (08:55 -0800)]
mtime_recursive: Add some comments and debugging diagnostics.

3 years agoAuto merge of #8934 - ehuss:token-process, r=alexcrichton
bors [Mon, 14 Dec 2020 16:22:53 +0000 (16:22 +0000)]
Auto merge of #8934 - ehuss:token-process, r=alexcrichton

Implement external credential process. (RFC 2730)

This adds a config setting for an external process to run to fetch the token for a registry. See `unstable.md` for more details.

As part of this, it adds a new `logout` command. This is currently gated on nightly with the appropriate `-Z` flag.

I have included four sample wrappers that integrate with the macOS Keychain, Windows Credential Manager, GNOME libsecret, and 1password. I'm not sure if we'll ultimately ship these, but I would like to. Primarily this provided a proof-of-concept to see if the design works.

**Patch Walkthrough**

This is a brief overview of the changes:

- Adds the `logout` command. With `cargo logout -Z unstable-options`, this allows removing the `token` from `.cargo/credentials`.  With `cargo logout -Z credential-process`, this launches the process with the `erase` argument to remove the token from storage.
- Credential-process handling is in the `ops/registry/auth.rs` module. I think it is pretty straightforward, it just launches the process with the appropriate store/get/erase argument.
- `ops::registry::registry()` now returns the `RegistryConfig` to make it easier to pass the config information around.
- `crates/credential/cargo-credential` is a helper crate for writing credential processes.
- A special shorthand of the `cargo:` prefix for a credential process will launch the named process from the `libexec` directory in the sysroot (or, more specifically, the `libexec` directory next to the `cargo` process). For example `credential-process = "cargo:macos-keychain"`. My intent is to bundle these in the pre-built rust-lang distributions, and this should "just work" when used with rustup. I'm not sure how that will work with other Rust distributions, but I'm guessing they can figure it out. This should make it much easier for users to get started, but does add some integration complexity.

**Questions**

- I'm on the fence about the name `credential-process` vs `credentials-process`, which sounds more natural? (Or something else?)
- I'm uneasy about the behavior when both `token` and `credential-process` is specified (see `warn_both_token_and_process` test). Currently it issues a warning and uses `token`. Does that make sense? What about the case where you have `registries.foo.token` for a specific registry, but then have a general `registry.credential-process` for the default (it currently warns and uses the token, maybe it should not warn?)?
- I am still pretty uneasy with writing FFI wrappers, so maybe those could get a little extra scrutiny? They seem to work, but I have not extensively tested them (I tried login, publish, and logout). I have not previously used these APIs, so I am not familiar with them.
- Testing the wrappers I think will be quite difficult, because some require TTY interaction (and 1password requires an online account). Or, for example in the macOS case, it has GUI dialog box where I can use my fingerprint scanner. Right now, I just build them in CI to make sure they compile.
- 1password is a little weird in that it passes the token on the command-line, which is not very secure on some systems (other processes can see these sometimes). The only alternative I can think of is to not support `cargo login` and require the user to manually enter the token in the 1password GUI. I don't think the concern is too large (1password themselves seem to think it is acceptable). Should this be OK?
- I'm a little uneasy with the design of `cargo login`, where it passes the token in stdin. If the wrapper requires stdin for user interaction (such as entering a password to unlock), this is quite awkward. There is a hack in the 1password example that demonstrates using `/dev/tty` and `CONIN$`, which *seems* to work, but I'm worried is fragile. I'm not very comfortable passing the token in environment variables, because those can be visible to other processes (like CLI args), but in some situations that shouldn't be too risky. Another option is to use a separate file descriptor/handle to pass the token in. Implementing that in Rust in a cross-platform way is not terribly easy, so I wanted to open this up for discussion first.

3 years agoStabilize RUSTC_WORKSPACE_WRAPPER
Eduardo Broto [Sun, 13 Dec 2020 22:50:15 +0000 (23:50 +0100)]
Stabilize RUSTC_WORKSPACE_WRAPPER

3 years agoCheck if rerun-if-changed points to a directory.
Eric Huss [Sat, 12 Dec 2020 21:59:51 +0000 (13:59 -0800)]
Check if rerun-if-changed points to a directory.

3 years agoAuto merge of #8968 - alexcrichton:revert-8834, r=ehuss
bors [Sat, 12 Dec 2020 18:07:59 +0000 (18:07 +0000)]
Auto merge of #8968 - alexcrichton:revert-8834, r=ehuss

Revert recent build-std vendoring changes

This reverts #8834 to address https://github.com/rust-lang/cargo/issues/8962 and https://github.com/rust-lang/cargo/issues/8963

cc `@Gankra`

3 years agoAuto merge of #8969 - alexcrichton:fix-cycle, r=ehuss
bors [Sat, 12 Dec 2020 17:38:07 +0000 (17:38 +0000)]
Auto merge of #8969 - alexcrichton:fix-cycle, r=ehuss

Fix the unit dependency graph with dev-dependency `links`

This commit fixes #8966 by updating the unit generation logic to avoid
generating an erroneous circular dependency between the execution of two
build scripts. This has been present for Cargo in a long time since #5651
(an accidental regression), but the situation appears rare enough that
we didn't get to it until now!

Closes #8966

3 years agoFix the unit dependency graph with dev-dependency `links`
Alex Crichton [Fri, 11 Dec 2020 17:57:49 +0000 (09:57 -0800)]
Fix the unit dependency graph with dev-dependency `links`

This commit fixes #8966 by updating the unit generation logic to avoid
generating an erroneous circular dependency between the execution of two
build scripts. This has been present for Cargo in a long time since #5651
(an accidental regression), but the situation appears rare enough that
we didn't get to it until now!

Closes #8966

3 years agoFix a test
Alex Crichton [Fri, 11 Dec 2020 16:43:27 +0000 (08:43 -0800)]
Fix a test

3 years agoRevert "Check if rust-src contains a vendor dir, and patch it in"
Alex Crichton [Fri, 11 Dec 2020 15:45:27 +0000 (07:45 -0800)]
Revert "Check if rust-src contains a vendor dir, and patch it in"

This reverts commit eadb4fc86c6660760ff857df41b7e88f6da0f714.

3 years agoRevert "Add error context for reading vendor dir."
Alex Crichton [Fri, 11 Dec 2020 15:45:22 +0000 (07:45 -0800)]
Revert "Add error context for reading vendor dir."

This reverts commit 85b5b180f49d0892d79fbd21c4cd37b634eee4ff.

3 years agoNote that cargo-credential-gnome-secret won't be available precompiled.
Eric Huss [Wed, 9 Dec 2020 17:17:41 +0000 (09:17 -0800)]
Note that cargo-credential-gnome-secret won't be available precompiled.

The rust-lang/rust build infrastructure uses a version of Linux that is
too old to support building this.

3 years agoChange behavior when both token and credential-process is specified.
Eric Huss [Tue, 8 Dec 2020 16:36:49 +0000 (08:36 -0800)]
Change behavior when both token and credential-process is specified.

Change it so that if both are specified, it is an error just to be safer
for now.

If token is specified for a registry, ignore the global
credential-process.

I'm still uncertain if this is the best behavior, but I think we can
tweak it later if needed.

3 years agoAuto merge of #8953 - hkennyv:clarify-package-edition-docs, r=Eh2406
bors [Mon, 7 Dec 2020 23:08:44 +0000 (23:08 +0000)]
Auto merge of #8953 - hkennyv:clarify-package-edition-docs, r=Eh2406

Clarify cargo manifest edition field docs

addresses #8951

This PR aims to clarify the documentation for the `edition` field in the Cargo manifest.

The confusion (IME) stems from the behavior of `cargo new` (defaults to writing edition = "2018") being confused for the default behavior of how Cargo interprets the manifest (`edition` is an optional key, defaults to 2015).

would love to get some other thoughts on how we can clarify this since it seems like I'm not the only one who got confused `@Eh2406`

3 years agoAuto merge of #8954 - Swatinem:doctest-in-workspace, r=alexcrichton
bors [Mon, 7 Dec 2020 16:34:40 +0000 (16:34 +0000)]
Auto merge of #8954 - Swatinem:doctest-in-workspace, r=alexcrichton

Run rustdoc doctests relative to the workspace

By doing so, rustdoc will also emit workspace-relative filenames for
the doctests.

fixes #8097

3 years agoAuto merge of #8950 - ehuss:publish-tarball-metadata, r=alexcrichton
bors [Mon, 7 Dec 2020 16:01:07 +0000 (16:01 +0000)]
Auto merge of #8950 - ehuss:publish-tarball-metadata, r=alexcrichton

Workaround fs issue in `cargo publish`.

`cargo publish` can fail on some filesystems with a mysterious "No such file or directory". The issue is that `statx` (and `fstat`) will fail on the 9p filesystem (which happens to be used by WSL2) after a file has been [renamed](https://github.com/rust-lang/cargo/blame/27187096a380fdd3b747b5d5ec3396b7af67a6f9/src/cargo/ops/cargo_package.rs#L133-L138). The solution for this workaround is to use seek instead of fstat to determine the length of the tarball.

More information about the 9p problem can be found at https://bugs.launchpad.net/qemu/+bug/1336794 and https://lists.gnu.org/archive/html/qemu-devel/2016-06/msg06382.html.

Fixes #8439

3 years agofix failures on linux
Arpad Borsos [Mon, 7 Dec 2020 08:25:49 +0000 (09:25 +0100)]
fix failures on linux

3 years agowordsmithing
Kenny Huynh [Mon, 7 Dec 2020 01:56:29 +0000 (17:56 -0800)]
wordsmithing

3 years agoRun rustdoc doctests relative to the workspace
Arpad Borsos [Sun, 6 Dec 2020 22:01:04 +0000 (23:01 +0100)]
Run rustdoc doctests relative to the workspace

By doing so, rustdoc will also emit workspace-relative filenames for
the doctests.

fixes #8097

3 years agoClarify cargo manifest edition field docs
Kenny Huynh [Sun, 6 Dec 2020 22:09:21 +0000 (14:09 -0800)]
Clarify cargo manifest edition field docs

3 years agoUpdate credential-process tracking issue number.
Eric Huss [Sun, 6 Dec 2020 19:30:11 +0000 (11:30 -0800)]
Update credential-process tracking issue number.

3 years agoValidate that the credential process only outputs a single line (token).
Eric Huss [Fri, 4 Dec 2020 22:09:06 +0000 (14:09 -0800)]
Validate that the credential process only outputs a single line (token).

3 years agoAdd some credential manifest metadata and READMEs.
Eric Huss [Fri, 4 Dec 2020 19:24:28 +0000 (11:24 -0800)]
Add some credential manifest metadata and READMEs.

3 years agoAdd docs on how cargo-credential finds the action argument.
Eric Huss [Fri, 4 Dec 2020 19:21:16 +0000 (11:21 -0800)]
Add docs on how cargo-credential finds the action argument.

3 years agoCheck for nul in Windows utf-16 wide-string.
Eric Huss [Fri, 4 Dec 2020 19:20:28 +0000 (11:20 -0800)]
Check for nul in Windows utf-16 wide-string.

3 years agoWorkaround fs issue in `cargo publish`.
Eric Huss [Sat, 5 Dec 2020 22:10:29 +0000 (14:10 -0800)]
Workaround fs issue in `cargo publish`.

3 years agoAuto merge of #8942 - ehuss:panic-no-roots, r=alexcrichton
bors [Fri, 4 Dec 2020 21:51:05 +0000 (21:51 +0000)]
Auto merge of #8942 - ehuss:panic-no-roots, r=alexcrichton

Fix panic with -Zbuild-std and no roots.

If a build command is run without any roots (like `cargo build` in a project with only tests), then cargo would panic with `-Z build-std`. This is because some parts of the code assumes that all units in the unit graph are reachable from the roots. However, the code was "attaching" the std units to the graph without a root.

The particular line that was panicking was [this one](https://github.com/rust-lang/cargo/blob/5c40b7f6dc94cffae0107d034ac1d1c6d3da18bf/src/cargo/core/compiler/context/mod.rs#L475) where it iterates over the units to check for collisions.  The outputs are calculated based on the roots (since they metadata computation has to walk the dep graph), so without any roots there was no metadata, and thus no outputs.

3 years agoFix panic with -Zbuild-std and no roots.
Eric Huss [Fri, 4 Dec 2020 21:34:09 +0000 (13:34 -0800)]
Fix panic with -Zbuild-std and no roots.

3 years agoAuto merge of #8937 - alexcrichton:optimize-vendor-a-bit, r=Eh2406
bors [Fri, 4 Dec 2020 15:14:25 +0000 (15:14 +0000)]
Auto merge of #8937 - alexcrichton:optimize-vendor-a-bit, r=Eh2406

Slightly optimize `cargo vendor`

I've noticed recently that `cargo vendor` feels really sluggish and
slow, and apparently this is primarily because we delete the registry
caches and re-extract all the tarballs. This commit implements one
possible optimization without changing this, however, which is that
currently we both copy a file and checksum it, but that ends up reading
all the contents twice. Those two functions are now folded into one,
shaving about 3s locally from Cargo's own vendor times.

3 years agoSlightly optimize `cargo vendor`
Alex Crichton [Thu, 3 Dec 2020 16:25:45 +0000 (08:25 -0800)]
Slightly optimize `cargo vendor`

I've noticed recently that `cargo vendor` feels really sluggish and
slow, and apparently this is primarily because we delete the registry
caches and re-extract all the tarballs. This commit implements one
possible optimization without changing this, however, which is that
currently we both copy a file and checksum it, but that ends up reading
all the contents twice. Those two functions are now folded into one,
shaving about 3s locally from Cargo's own vendor times.

3 years agoAuto merge of #8912 - aniljava:master, r=alexcrichton
bors [Thu, 3 Dec 2020 15:14:39 +0000 (15:14 +0000)]
Auto merge of #8912 - aniljava:master, r=alexcrichton

Fixes #8783 , cargo new fails without a author name or email

If user can not be obtained from git or env variables $USER, new command defaults to empty author in generated Cargo.toml

Could not edit old PR(#8910 8783) as the original clone was deleted.

3 years agoRemoved debug println!
Anil P [Thu, 3 Dec 2020 05:04:00 +0000 (23:04 -0600)]
Removed debug println!

3 years agorustfmt
Anil P [Thu, 3 Dec 2020 05:02:55 +0000 (23:02 -0600)]
rustfmt

3 years agoExplicitly removed USER env variables.
Anil P [Thu, 3 Dec 2020 04:59:40 +0000 (22:59 -0600)]
Explicitly removed USER env variables.

3 years agoImplement credential-process.
Eric Huss [Tue, 1 Dec 2020 19:16:16 +0000 (11:16 -0800)]
Implement credential-process.

3 years agoAuto merge of #8929 - ehuss:fix-git-config-author, r=Eh2406
bors [Wed, 2 Dec 2020 22:12:37 +0000 (22:12 +0000)]
Auto merge of #8929 - ehuss:fix-git-config-author, r=Eh2406

Fix test escaping __CARGO_TEST_ROOT

#8886 added a test which unsets `__CARGO_TEST_ROOT`, but that environment variable is there for a reason. This causes problems as it causes that test to load the `.cargo/config` from the real home directory, which if it contains a `[cargo-new]` section, causes the test to fail.

The fix here is to change `find_tests_git_config` so that it behaves more like the real git config loader, but avoids escaping the test sandbox.  There are some subtle issues here, like #7469, which I believe should still work correctly.

3 years agoMerge remote-tracking branch 'upstream/master'
Anil P [Wed, 2 Dec 2020 18:43:30 +0000 (12:43 -0600)]
Merge remote-tracking branch 'upstream/master'

3 years agoRemoved debug println from earlier commit.
Anil P [Wed, 2 Dec 2020 18:39:29 +0000 (12:39 -0600)]
Removed debug println from earlier commit.

3 years agoReplaced the match arm with better coding convention.
Anil P [Wed, 2 Dec 2020 18:15:14 +0000 (12:15 -0600)]
Replaced the match arm with better coding convention.

3 years agoAuto merge of #8932 - ehuss:features-with-dot, r=alexcrichton
bors [Wed, 2 Dec 2020 16:36:59 +0000 (16:36 +0000)]
Auto merge of #8932 - ehuss:features-with-dot, r=alexcrichton

Add period to allowed feature name characters.

Relaxes the warning to allow `.` in feature names, requested via https://github.com/rust-lang/cargo/issues/8813#issuecomment-731862927

3 years agoAdd period to allowed feature name characters.
Eric Huss [Wed, 2 Dec 2020 15:56:44 +0000 (07:56 -0800)]
Add period to allowed feature name characters.

3 years agoAuto merge of #8931 - tshepang:patch-1, r=Eh2406
bors [Wed, 2 Dec 2020 15:06:46 +0000 (15:06 +0000)]
Auto merge of #8931 - tshepang:patch-1, r=Eh2406

faq: small fixes

3 years agoAuto merge of #8930 - ehuss:fix-semver-msg, r=Eh2406
bors [Wed, 2 Dec 2020 14:39:12 +0000 (14:39 +0000)]
Auto merge of #8930 - ehuss:fix-semver-msg, r=Eh2406

Fix semver documentation tests.

GitHub just updated the VM image to include the latest stable rust (1.48), which included some minor changes to diagnostic outputs.  This updates the semver chapter tests which validates that the correct error is displayed for the 1.48 release.  These diagnostics were changed via https://github.com/rust-lang/rust/pull/76524 and https://github.com/rust-lang/rust/pull/73996.

3 years agofaq: small fixes
Tshepang Lekhonkhobe [Wed, 2 Dec 2020 08:09:59 +0000 (10:09 +0200)]
faq: small fixes

3 years agoMerge remote-tracking branch 'upstream/master'
Anil P [Wed, 2 Dec 2020 07:00:30 +0000 (01:00 -0600)]
Merge remote-tracking branch 'upstream/master'

Remote

3 years agoFix semver documentation tests.
Eric Huss [Wed, 2 Dec 2020 06:21:24 +0000 (22:21 -0800)]
Fix semver documentation tests.

3 years agoFix test escaping __CARGO_TEST_ROOT
asdf [Wed, 2 Dec 2020 05:58:32 +0000 (21:58 -0800)]
Fix test escaping __CARGO_TEST_ROOT

3 years agochanged return type as discover_author no longer bails
Anil P [Wed, 2 Dec 2020 05:48:38 +0000 (23:48 -0600)]
changed return type as discover_author no longer bails

Return type changed to plain tuples instead of CargoResult as the function does not bail with error if the author name is missing.

3 years agoTest cargo new with missing authors
Anil P [Wed, 2 Dec 2020 05:46:16 +0000 (23:46 -0600)]
Test cargo new with missing authors

- test case for missing name and email (author_without_user_or_email)
- test case for handling email only (finds_author_email_only)

3 years agoFix: unavailable author for cargo new
Anil P [Wed, 2 Dec 2020 05:42:33 +0000 (23:42 -0600)]
Fix: unavailable author for cargo new

- if author name and email not found from config or env variables, defaults to an empty author list authors = []
- simplified selection of name + email from available choices in (fn mk)

3 years agoAuto merge of #8725 - chaaz:master, r=ehuss
bors [Wed, 2 Dec 2020 01:44:30 +0000 (01:44 +0000)]
Auto merge of #8725 - chaaz:master, r=ehuss

Add "--workspace" to update command

My `--bin` project has CI which updates the version number in `Cargo.toml`, which it then commits. However, this means that any further cargo command (`build`, `test`, etc) will update the existing `Cargo.lock` file (updating the root version), causing some frustration for users. Furthermore, it breaks the `publish` command, which requires the repo to be current.

I've added a `sync-lockfile` command to simply update the root version in the `Cargo.lock` file to match the `Cargo.toml` in the same way that simple commands like `fetch` do. If no `Cargo.lock` file is present, and new one is generated based on the index.

This is a demo PR for Pre-RFC conversation at https://internals.rust-lang.org/t/pre-rfc-cargo-command-to-just-sync-lockfile/13119, but may become a real PR if it gets approval.

3 years agoAuto merge of #8927 - alexcrichton:why-rebuild, r=Eh2406
bors [Tue, 1 Dec 2020 16:02:57 +0000 (16:02 +0000)]
Auto merge of #8927 - alexcrichton:why-rebuild, r=Eh2406

Add an FAQ for "Why is my crate rebuilt?"

In hindsight we should have added this long ago, but I feel like we get
this enough that it's worth adding a deidcated entry we can point to.

3 years agoAdd an FAQ for "Why is my crate rebuilt?"
Alex Crichton [Tue, 1 Dec 2020 15:50:46 +0000 (07:50 -0800)]
Add an FAQ for "Why is my crate rebuilt?"

In hindsight we should have added this long ago, but I feel like we get
this enough that it's worth adding a deidcated entry we can point to.

3 years agoAuto merge of #8877 - jyn514:rustdoc-map, r=alexcrichton
bors [Tue, 1 Dec 2020 15:34:20 +0000 (15:34 +0000)]
Auto merge of #8877 - jyn514:rustdoc-map, r=alexcrichton

Set docs.rs as the default extern-map for crates.io

Helps address https://github.com/rust-lang/cargo/issues/8296, specifically the bit needed for https://github.com/rust-lang/docs.rs/issues/1177.
r? `@ehuss`

3 years agoAuto merge of #8924 - gdoenlen:patch-1, r=ehuss
bors [Tue, 1 Dec 2020 01:31:17 +0000 (01:31 +0000)]
Auto merge of #8924 - gdoenlen:patch-1, r=ehuss

remove extra whitespace when running cargo -Z help

3 years agoremove extra whitespace when running cargo -Z help
George [Tue, 1 Dec 2020 01:24:46 +0000 (01:24 +0000)]
remove extra whitespace when running cargo -Z help

3 years agoAuto merge of #8920 - ehuss:publish-dev-dependencies, r=Eh2406
bors [Mon, 30 Nov 2020 16:18:13 +0000 (16:18 +0000)]
Auto merge of #8920 - ehuss:publish-dev-dependencies, r=Eh2406

Remove version from dev-dependencies to make it easier to publish.

Since #7333, released in 1.40, Cargo will strip dev-dependencies that don't have a version.  These two crates aren't published to crates.io, and thus they have to be commented out each time a release is made. This change avoids that step.

3 years agoUse `deserialize_with` instead of specializing `doc_extern_map`
Joshua Nelson [Thu, 26 Nov 2020 05:46:30 +0000 (00:46 -0500)]
Use `deserialize_with` instead of specializing `doc_extern_map`

3 years agoRemove version from dev-dependencies to make it easier to publish.
Eric Huss [Mon, 30 Nov 2020 16:12:02 +0000 (08:12 -0800)]
Remove version from dev-dependencies to make it easier to publish.

3 years agoAuto merge of #8908 - JoshMcguigan:dependency-queue-cost, r=alexcrichton
bors [Mon, 30 Nov 2020 15:25:11 +0000 (15:25 +0000)]
Auto merge of #8908 - JoshMcguigan:dependency-queue-cost, r=alexcrichton

update dependency queue to consider cost for each node

In support of #7437, this updates the dependency queue implementation to consider a non-fixed cost for each node. The behavior of this implementation should match the previous implementation if all units are assigned the same cost by the code which calls the `queue` method (which is what we do for now).

In the future I can think of at least two ways these costs could be used:

1. Use some known constant value by default (say 100 as I've done in this PR), and allow the user to provide hints for certain units to influence compilation order (as requested in #7437).
2. Take timing data from a previous compilation (perhaps the json output of `cargo build -Ztimings=json`) and use the actual time required to compile a given unit (in milliseconds) as its cost. Any units not included in the provided timing data could perhaps have their cost set to the median cost of all crates included in the timing data.

3 years agoAuto merge of #8911 - ehuss:rustdoc-warnings, r=alexcrichton
bors [Sun, 29 Nov 2020 19:46:40 +0000 (19:46 +0000)]
Auto merge of #8911 - ehuss:rustdoc-warnings, r=alexcrichton

Fix some rustdoc warnings.

Silences some warnings from rustdoc.  `SourceKind` is private and can't be linked from a public type.

3 years agoAuto merge of #8909 - faern:bump-miow, r=alexcrichton
bors [Sun, 29 Nov 2020 19:18:04 +0000 (19:18 +0000)]
Auto merge of #8909 - faern:bump-miow, r=alexcrichton

Bump miow dependency to not invalidly assume memory layout

See https://github.com/rust-lang/rust/pull/78802 and https://github.com/yoshuawuyts/miow/pull/39

3 years agoAuto merge of #8906 - Aaron1011:fix/trailing-semi, r=alexcrichton
bors [Sun, 29 Nov 2020 18:51:39 +0000 (18:51 +0000)]
Auto merge of #8906 - Aaron1011:fix/trailing-semi, r=alexcrichton

Remove unnecessary trailing semicolons

PR https://github.com/rust-lang/rust/pull/78296 will cause rustc to
start warning on semicolons following item statements.

3 years agoAuto merge of #8907 - ehuss:auto_traits, r=alexcrichton
bors [Sun, 29 Nov 2020 18:24:49 +0000 (18:24 +0000)]
Auto merge of #8907 - ehuss:auto_traits, r=alexcrichton

Fix custom_target_dependency test.

The feature was renamed in https://github.com/rust-lang/rust/pull/79336

3 years agoFixes #8783
Anil P [Sun, 29 Nov 2020 03:35:03 +0000 (21:35 -0600)]
Fixes #8783

If user can not be obtained from git or env variables $USER, new command defaults to empty author in generated Cargo.toml

3 years agoFix some rustdoc warnings.
Eric Huss [Sun, 29 Nov 2020 01:52:00 +0000 (17:52 -0800)]
Fix some rustdoc warnings.

3 years agoBump miow dependency to not invalidly assume memory layout
Linus Färnstrand [Sat, 28 Nov 2020 10:47:15 +0000 (11:47 +0100)]
Bump miow dependency to not invalidly assume memory layout

3 years agoupdate dependency queue to consider cost for each node
Josh Mcguigan [Sat, 28 Nov 2020 02:31:40 +0000 (18:31 -0800)]
update dependency queue to consider cost for each node