]> git.proxmox.com Git - cargo.git/log
cargo.git
4 years agoAuto merge of #8454 - GabrielMajeri:config-option-enum, r=ehuss
bors [Tue, 7 Jul 2020 15:51:28 +0000 (15:51 +0000)]
Auto merge of #8454 - GabrielMajeri:config-option-enum, r=ehuss

Add support for deserializing enums in config files

Implements `deserialize_enum` functionality to allow config options which are Rust enums.

@ehuss The code currently has some `todo!`s because I'm not sure how the custom `Deserializer` is supposed to do error handling.

Fixes #8450

4 years agoImplement enum config options deserialization
Gabriel Majeri [Sun, 5 Jul 2020 07:00:08 +0000 (10:00 +0300)]
Implement enum config options deserialization

4 years agoAuto merge of #8453 - sourcefrog:name-length-limit-8452, r=alexcrichton
bors [Mon, 6 Jul 2020 15:27:16 +0000 (15:27 +0000)]
Auto merge of #8453 - sourcefrog:name-length-limit-8452, r=alexcrichton

Write GNU tar files, supporting long names.

Fixes #8452

If I understand the previous bugs correctly, long trees packaged using Cargo with this patch will be misinterpreted by Cargo from before Jan 2016. (Without this patch, they can't be written at all.)

To me that seems like long enough ago that it's safe to land this now.

- [x] Add a test.

4 years agoAuto merge of #8449 - jyn514:rustdoc, r=ehuss
bors [Mon, 6 Jul 2020 14:50:12 +0000 (14:50 +0000)]
Auto merge of #8449 - jyn514:rustdoc, r=ehuss

Don't overwrite existing `rustdoc` args with --document-private-items

Instead, add that flag in addition to any existing flags.

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

4 years agoAuto merge of #8455 - ehuss:rustup-toolchain, r=Eh2406
bors [Mon, 6 Jul 2020 14:04:54 +0000 (14:04 +0000)]
Auto merge of #8455 - ehuss:rustup-toolchain, r=Eh2406

Add some help about rustup's +toolchain syntax.

This tries to bring more attention to the `+toolchain` syntax from rustup.

Closes #8058

4 years agoAdd some help about rustup's +toolchain syntax.
Eric Huss [Sat, 4 Jul 2020 22:03:54 +0000 (15:03 -0700)]
Add some help about rustup's +toolchain syntax.

4 years agoAuto merge of #8451 - ehuss:metadata-man, r=Eh2406
bors [Sun, 5 Jul 2020 14:48:57 +0000 (14:48 +0000)]
Auto merge of #8451 - ehuss:metadata-man, r=Eh2406

Update metadata man page.

The man pages needed to be rebuilt after #8323.

4 years agoAdd a test reproducing the issue
Gabriel Majeri [Sun, 5 Jul 2020 06:59:56 +0000 (09:59 +0300)]
Add a test reproducing the issue

4 years agoAdd test for packaging long file names
Martin Pool [Sun, 5 Jul 2020 00:52:02 +0000 (17:52 -0700)]
Add test for packaging long file names

4 years agoWrite GNU tar files, supporting long names.
Martin Pool [Sun, 5 Jul 2020 00:36:18 +0000 (17:36 -0700)]
Write GNU tar files, supporting long names.

Fixes #8452

4 years agoUpdate metadata man page.
Eric Huss [Sat, 4 Jul 2020 22:06:58 +0000 (15:06 -0700)]
Update metadata man page.

4 years agoUse entry API instead of a match
Joshua Nelson [Sat, 4 Jul 2020 19:47:26 +0000 (15:47 -0400)]
Use entry API instead of a match

This makes the code easier to read and also avoids looking up the
position in the map twice. The clone of `unit` is very cheap since it is
an Rc.

4 years agoUse a stable rustdoc option for testing
Joshua Nelson [Sat, 4 Jul 2020 19:04:44 +0000 (15:04 -0400)]
Use a stable rustdoc option for testing

4 years agoDon't overwrite existing `rustdoc` args with --document-private-items
Joshua Nelson [Sat, 4 Jul 2020 02:09:31 +0000 (22:09 -0400)]
Don't overwrite existing `rustdoc` args with --document-private-items

Instead, add that flag in addition to any existing flags.

4 years agoAuto merge of #8446 - ehuss:fix-usize-32, r=alexcrichton
bors [Thu, 2 Jul 2020 21:51:34 +0000 (21:51 +0000)]
Auto merge of #8446 - ehuss:fix-usize-32, r=alexcrichton

Fix overflow error on 32-bit.

This fails to compile on 32-bit platforms with an overflow error ("attempt to shift right by 32_i32 which would overflow").

I think it would be highly unlikely for any value to be in the billions.  Alternatively it can be rewritten to something like `assert!(val <= u32::MAX as usize);`.

4 years agoFix overflow error on 32-bit.
Eric Huss [Thu, 2 Jul 2020 21:48:01 +0000 (14:48 -0700)]
Fix overflow error on 32-bit.

4 years agoAuto merge of #8378 - jstasiak:backups, r=ehuss
bors [Thu, 2 Jul 2020 14:49:38 +0000 (14:49 +0000)]
Auto merge of #8378 - jstasiak:backups, r=ehuss

Exclude the target directory from backups using CACHEDIR.TAG

This patch follows the lead of #4386 (which excludes target directories
from Time Machine backups) and is motived by the same reasons listen
in #3884. CACHEDIR.TAG is an OS-independent mechanism supported by Borg,
restic, GNU Tar and other backup/archiving solutions.

See https://bford.info/cachedir/ for more information about the
specification. This has been discussed in Rust Internals earlier this
year[1] and it seems like it's an uncontroversial improvement so I went
ahead with the patch.

One thing I'm wondering is whether this should maybe cover the whole main target directory (right now it applies to `target/debug`, `target/release` etc. but not to target root).

[1] https://internals.rust-lang.org/t/pre-rfc-put-cachedir-tag-into-target/12262/11

4 years agoAuto merge of #8436 - joshtriplett:zulip, r=alexcrichton
bors [Thu, 2 Jul 2020 14:13:55 +0000 (14:13 +0000)]
Auto merge of #8436 - joshtriplett:zulip, r=alexcrichton

CONTRIBUTING.md: Link to Zulip rather than Discord

Discussed and approved by all members of the Cargo team.

4 years agoCONTRIBUTING.md: Link to Zulip rather than Discord
Josh Triplett [Wed, 1 Jul 2020 22:10:43 +0000 (15:10 -0700)]
CONTRIBUTING.md: Link to Zulip rather than Discord

Discussed and approved by all members of the Cargo team.

4 years agoRemove no longer needed cleanup code
Jakub Stasiak [Wed, 1 Jul 2020 21:44:14 +0000 (23:44 +0200)]
Remove no longer needed cleanup code

4 years agoCompress two tests into one
Jakub Stasiak [Wed, 1 Jul 2020 20:47:38 +0000 (22:47 +0200)]
Compress two tests into one

4 years agoExclude whole target/ from backups
Jakub Stasiak [Wed, 1 Jul 2020 20:40:31 +0000 (22:40 +0200)]
Exclude whole target/ from backups

This is following the discussion on GitHub. The doc tests are no longer
necessary because Layout::new() creates CACHEDIR.TAG directly in target
root, no doc-specific code is necessary anymore.

4 years agoAuto merge of #8433 - giraffate:update_built-in_help_for_features, r=alexcrichton
bors [Wed, 1 Jul 2020 16:03:23 +0000 (16:03 +0000)]
Auto merge of #8433 - giraffate:update_built-in_help_for_features, r=alexcrichton

Update built-in help for features

Fixed #8381.

4 years agoExclude target/doc from backups as well
Jakub Stasiak [Wed, 1 Jul 2020 12:11:07 +0000 (14:11 +0200)]
Exclude target/doc from backups as well

4 years agoUpdate built-in help for features
Takayuki Nakata [Tue, 30 Jun 2020 23:28:20 +0000 (08:28 +0900)]
Update built-in help for features

Fixed #8381.

4 years agoAuto merge of #8432 - rust-lang:dependabot/cargo/core-foundation-0.9.0, r=alexcrichton
bors [Tue, 30 Jun 2020 14:16:08 +0000 (14:16 +0000)]
Auto merge of #8432 - rust-lang:dependabot/cargo/core-foundation-0.9.0, r=alexcrichton

Update core-foundation requirement from 0.7.0 to 0.9.0

Updates the requirements on [core-foundation](https://github.com/servo/core-foundation-rs) to permit the latest version.
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/servo/core-foundation-rs/commit/a57ca7f976858f56ab159656703a2857fa947870"><code>a57ca7f</code></a> Major version update for core-foundation-sys and all other dependencies.</li>
<li><a href="https://github.com/servo/core-foundation-rs/commit/aa69b91def2137addf61f27fb94077d8318dad4f"><code>aa69b91</code></a> Add missing major version changes.</li>
<li><a href="https://github.com/servo/core-foundation-rs/commit/7487580958a60d5a51228bdc211a4f53dfe4b4ca"><code>7487580</code></a> Publish core-foundation-sys 0.7.2.</li>
<li><a href="https://github.com/servo/core-foundation-rs/commit/40a787f0e6a2f7b3874f4f1b3a6b9fc5a3a165ff"><code>40a787f</code></a> Auto merge of <a href="https://github-redirect.dependabot.com/servo/core-foundation-rs/issues/397">#397</a> - servo:major-bump, r=jdm</li>
<li><a href="https://github.com/servo/core-foundation-rs/commit/56d8b6c161ad3db0adc59853951163658b3e97b1"><code>56d8b6c</code></a> Major version change for core-foundation, core-graphics, io-surface, core-tex...</li>
<li><a href="https://github.com/servo/core-foundation-rs/commit/37540073110db955230c67f87e50fb55a9a4447c"><code>3754007</code></a> Auto merge of <a href="https://github-redirect.dependabot.com/servo/core-foundation-rs/issues/395">#395</a> - bryanburgers:timezone-name, r=jdm</li>
<li><a href="https://github.com/servo/core-foundation-rs/commit/a4e29832190de6d58bd59ccd52289476689cd995"><code>a4e2983</code></a> Add <code>CFTimeZone::name</code></li>
<li><a href="https://github.com/servo/core-foundation-rs/commit/749c0855ad2764ffcc4fef6fed40670f421ae186"><code>749c085</code></a> Auto merge of <a href="https://github-redirect.dependabot.com/servo/core-foundation-rs/issues/394">#394</a> - anp:releases, r=jdm</li>
<li><a href="https://github.com/servo/core-foundation-rs/commit/9c264d290423c10d0801d2acdb66c17ec9f8755c"><code>9c264d2</code></a> Bump core-foundation(-sys) to 0.7.1 for release.</li>
<li><a href="https://github.com/servo/core-foundation-rs/commit/d196c0c4c8641fadcdb4553b77e3491f76a136ff"><code>d196c0c</code></a> Publish core-graphics 0.19.2.</li>
<li>Additional commits viewable in <a href="https://github.com/servo/core-foundation-rs/compare/core-foundation-v0.7.0...core-foundation-v0.9.0">compare view</a></li>
</ul>
</details>
<br />

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Pull request limits (per update run and/or open at any time)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)

</details>

4 years agoUpdate core-foundation requirement from 0.7.0 to 0.9.0
dependabot-preview[bot] [Tue, 30 Jun 2020 05:24:50 +0000 (05:24 +0000)]
Update core-foundation requirement from 0.7.0 to 0.9.0

Updates the requirements on [core-foundation](https://github.com/servo/core-foundation-rs) to permit the latest version.
- [Release notes](https://github.com/servo/core-foundation-rs/releases)
- [Commits](https://github.com/servo/core-foundation-rs/compare/core-foundation-v0.7.0...core-foundation-v0.9.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
4 years agoAuto merge of #8421 - alexcrichton:read-env-dep, r=ehuss
bors [Tue, 30 Jun 2020 02:40:18 +0000 (02:40 +0000)]
Auto merge of #8421 - alexcrichton:read-env-dep, r=ehuss

Parse `# env-dep` directives in dep-info files

This commit updates Cargo's parsing of rustc's dep-info files to account
for changes made upstream in rust-lang/rust#71858. This means that if
`env!` or `option_env!` is used in crate files Cargo will correctly
rebuild the crate if the env var changes.

Closes #8417

4 years agoAuto merge of #8419 - est31:string_interning, r=ehuss
bors [Mon, 29 Jun 2020 23:56:15 +0000 (23:56 +0000)]
Auto merge of #8419 - est31:string_interning, r=ehuss

Move string interning to util

Code that handles string interning is rather an util functionality than
a core functionality.

4 years agoHandle env var escaping
Alex Crichton [Mon, 29 Jun 2020 19:57:09 +0000 (12:57 -0700)]
Handle env var escaping

4 years agoBump hashed metadata version
Alex Crichton [Mon, 29 Jun 2020 19:39:44 +0000 (12:39 -0700)]
Bump hashed metadata version

4 years agoAddress review feedback
Alex Crichton [Mon, 29 Jun 2020 18:19:10 +0000 (11:19 -0700)]
Address review feedback

4 years agoGet past internal test on CI
Alex Crichton [Mon, 29 Jun 2020 15:52:05 +0000 (08:52 -0700)]
Get past internal test on CI

4 years agoFilter env vars to check against
Alex Crichton [Mon, 29 Jun 2020 15:26:10 +0000 (08:26 -0700)]
Filter env vars to check against

4 years agoParse `# env-dep` directives in dep-info files
Alex Crichton [Fri, 26 Jun 2020 19:30:42 +0000 (12:30 -0700)]
Parse `# env-dep` directives in dep-info files

This commit updates Cargo's parsing of rustc's dep-info files to account
for changes made upstream in rust-lang/rust#71858. This means that if
`env!` or `option_env!` is used in crate files Cargo will correctly
rebuild the crate if the env var changes.

Closes #8417

4 years agoAuto merge of #8418 - bdonlan:cdylib-out-path, r=alexcrichton
bors [Fri, 26 Jun 2020 19:35:23 +0000 (19:35 +0000)]
Auto merge of #8418 - bdonlan:cdylib-out-path, r=alexcrichton

Expose built cdylib artifacts in the Compilation structure

This change makes it much easier to find these artifacts in a
platform-independent way when writing automation around the cargo API.

4 years agoMake leak function private
est31 [Fri, 26 Jun 2020 17:51:47 +0000 (19:51 +0200)]
Make leak function private

The leak function is never used outside of interning.rs
and I don't think it makes any sense to use it.

4 years agoMove string interning to util
est31 [Fri, 26 Jun 2020 17:46:20 +0000 (19:46 +0200)]
Move string interning to util

Code that handles string interning is rather an util functionality than
a core functionality.

4 years agoExpose built cdylib artifacts in the Compilation structure
Bryan Donlan [Wed, 24 Jun 2020 21:45:55 +0000 (21:45 +0000)]
Expose built cdylib artifacts in the Compilation structure

This change makes it much easier to find these artifacts in a
platform-independent way when writing automation around the cargo API.

4 years agoAuto merge of #8416 - est31:remove_derive, r=alexcrichton
bors [Fri, 26 Jun 2020 16:33:12 +0000 (16:33 +0000)]
Auto merge of #8416 - est31:remove_derive, r=alexcrichton

Remove unused serde_derive dependency from the crates.io crate

4 years agoRemove unused serde_derive dependency
est31 [Fri, 26 Jun 2020 15:28:40 +0000 (17:28 +0200)]
Remove unused serde_derive dependency

4 years agoAuto merge of #8412 - est31:remove_remove, r=alexcrichton
bors [Fri, 26 Jun 2020 14:13:00 +0000 (14:13 +0000)]
Auto merge of #8412 - est31:remove_remove, r=alexcrichton

Remove unused remove_dir_all dependency

Originally part of #8384 but sadly the PR got rejected.

4 years agoRemove unused remove_dir_all dependency
est31 [Fri, 26 Jun 2020 04:37:04 +0000 (06:37 +0200)]
Remove unused remove_dir_all dependency

Need to research why it isn't detected by cargo-udeps.

4 years agoAuto merge of #8409 - alexcrichton:git-instead-of, r=Eh2406
bors [Thu, 25 Jun 2020 18:47:08 +0000 (18:47 +0000)]
Auto merge of #8409 - alexcrichton:git-instead-of, r=Eh2406

Improve git error messages a bit

This commit is targeted at further improving the error messages
generated from git errors. For authentication errors the actual URL
fetched is now printed out as well if it's different from the original
URL. This should help handle `insteadOf` logic where SSH urls are used
instead of HTTPS urls and users can know to track that down.

Otherwise the logic about recommending `net.git-fetch-with-cli` was
tweaked a bit and moved to the same location as the rest of our error
reporting.

Note that a change piggy-backed here as well is that `Caused by:` errors
are now automatically all tabbed over a bit instead of only having the
first line tabbed over. This required a good number of tests to be
updated, but it's just an updated in renderings.

4 years agoImprove git error messages a bit
Alex Crichton [Thu, 25 Jun 2020 15:25:52 +0000 (08:25 -0700)]
Improve git error messages a bit

This commit is targeted at further improving the error messages
generated from git errors. For authentication errors the actual URL
fetched is now printed out as well if it's different from the original
URL. This should help handle `insteadOf` logic where SSH urls are used
instead of HTTPS urls and users can know to track that down.

Otherwise the logic about recommending `net.git-fetch-with-cli` was
tweaked a bit and moved to the same location as the rest of our error
reporting.

Note that a change piggy-backed here as well is that `Caused by:` errors
are now automatically all tabbed over a bit instead of only having the
first line tabbed over. This required a good number of tests to be
updated, but it's just an updated in renderings.

4 years agoAuto merge of #8408 - jstasiak:improve-home-path-documentation, r=alexcrichton
bors [Thu, 25 Jun 2020 14:12:00 +0000 (14:12 +0000)]
Auto merge of #8408 - jstasiak:improve-home-path-documentation, r=alexcrichton

Improve the description of Config.home_path

I poked around and it seems it's not the user's home directory but Cargo
home (which may or may not be in user's home).

4 years agoImprove the description of Config.home_path
Jakub Stasiak [Thu, 25 Jun 2020 13:17:26 +0000 (15:17 +0200)]
Improve the description of Config.home_path

I poked around and it seems it's not the user's home directory but Cargo
home (which may or may not be in user's home).

4 years agoTry to resolve a build-time conflict with master
Jakub Stasiak [Wed, 24 Jun 2020 21:49:56 +0000 (23:49 +0200)]
Try to resolve a build-time conflict with master

This commit changed things a bit: 6263d726f6b32ff7bcb5e1c292e0c83d65145e41.

4 years agoAdd two tests
Jakub Stasiak [Wed, 24 Jun 2020 21:22:20 +0000 (23:22 +0200)]
Add two tests

4 years agoAuto merge of #8364 - alexcrichton:default-no-master, r=ehuss
bors [Wed, 24 Jun 2020 20:09:07 +0000 (20:09 +0000)]
Auto merge of #8364 - alexcrichton:default-no-master, r=ehuss

Improve support for non-`master` main branches

This commit improves Cargo's support for git repositories whose "main
branch" is not called `master`. Cargo currently pretty liberally assumes
that if nothing else about a git repository is specified then `master`
is the branch name to use. Instead now Cargo has a fourth option as the
desired reference of a repository named `DefaultBranch`. Cargo doesn't
know anything about the actual name of the default branch, it just
updates how git references are fetched internally.

This commit is motivated by news that GitHub is likely to switch away
from the default branch being named `master` in the near future. It
would be a bit of a bummer if from now on everyone had to type
`branch = '...'`, so this tries to improve that!

Closes #3517

4 years agoAuto merge of #8403 - matklad:abs-out-dir, r=Eh2406
bors [Wed, 24 Jun 2020 18:12:36 +0000 (18:12 +0000)]
Auto merge of #8403 - matklad:abs-out-dir, r=Eh2406

Document that OUT_DIR in JSON messages is an absolute path

4 years agoDocument that OUT_DIR in JSON messages is an absolute path
Aleksey Kladov [Wed, 24 Jun 2020 10:56:29 +0000 (12:56 +0200)]
Document that OUT_DIR in JSON messages is an absolute path

4 years agoAuto merge of #8387 - robinmoussu:master, r=alexcrichton
bors [Tue, 23 Jun 2020 16:21:21 +0000 (16:21 +0000)]
Auto merge of #8387 - robinmoussu:master, r=alexcrichton

Adding environment variable CARGO_PKG_LICENSE_FILE

When #8325 was added, only CARGO_PKG_LICENSE was added. However, the field license [may be empty](https://doc.rust-lang.org/cargo/reference/manifest.html#the-license-and-license-file-fields) if the license_field is filled in.

4 years agoAuto merge of #8391 - bl2e:install-target-dir, r=alexcrichton
bors [Tue, 23 Jun 2020 15:48:36 +0000 (15:48 +0000)]
Auto merge of #8391 - bl2e:install-target-dir, r=alexcrichton

Enable "--target-dir" in "cargo install"

Issue #8263

4 years agoAuto merge of #8323 - naerbnic:add_workspace_metadata_table, r=alexcrichton
bors [Tue, 23 Jun 2020 15:18:10 +0000 (15:18 +0000)]
Auto merge of #8323 - naerbnic:add_workspace_metadata_table, r=alexcrichton

Add support for `workspace.metadata` table

Implements feature request #8309

Additionally includes the information in the output of "cargo metadata" through a new top-level field `metadata`, similar to the per-package `metadata` field

4 years agoAuto merge of #8398 - ehuss:clean-reserved-name, r=Eh2406
bors [Mon, 22 Jun 2020 21:07:37 +0000 (21:07 +0000)]
Auto merge of #8398 - ehuss:clean-reserved-name, r=Eh2406

Fix overzealous `clean -p` for reserved names.

#8210 changed the way `clean -p` worked, but in some ways it is a little too sloppy.  If a package has a test named `build`, then it would delete the `build` directory thinking an executable named "build" exists.  This changes it so that it does not attempt to delete tests/benches from the uplift directory.

4 years agoFix overzealous `clean -p` for reserved names.
Eric Huss [Mon, 22 Jun 2020 19:56:10 +0000 (12:56 -0700)]
Fix overzealous `clean -p` for reserved names.

4 years agoAuto merge of #8395 - ehuss:fix-opt-dep-order, r=Eh2406
bors [Mon, 22 Jun 2020 00:35:00 +0000 (00:35 +0000)]
Auto merge of #8395 - ehuss:fix-opt-dep-order, r=Eh2406

Fix order-dependent feature resolution.

There is a situation where if you have `pkg/feature` syntax, and `pkg` is an optional dependency, but also a dev-dependency, and the dev-dependency appears before the (optional) normal dependency in the summary, then the optional dependency would not get activated. This is because the feature code used `find` to get the first entry.

Fixes #8394

4 years agoFix order-dependent feature resolution.
Eric Huss [Mon, 22 Jun 2020 00:28:36 +0000 (17:28 -0700)]
Fix order-dependent feature resolution.

4 years agoFix post-execution path checks to be compatible with Windows
bl2e [Sun, 21 Jun 2020 06:37:56 +0000 (23:37 -0700)]
Fix post-execution  path checks to be compatible with Windows

4 years agoFix test compatibility for Windows
bl2e [Sun, 21 Jun 2020 06:00:55 +0000 (23:00 -0700)]
Fix test compatibility for Windows

4 years agoReference options-target-dir in `cargo install` documentation
bl2e [Sun, 21 Jun 2020 04:29:02 +0000 (21:29 -0700)]
Reference options-target-dir in `cargo install` documentation

4 years agoAdd test for `cargo install` option `--target-dir`
bl2e [Sun, 21 Jun 2020 00:13:10 +0000 (17:13 -0700)]
Add test for `cargo install` option `--target-dir`

4 years agoEnable `--target-dir` support in `install` subcommand
bl2e [Thu, 18 Jun 2020 23:21:04 +0000 (16:21 -0700)]
Enable `--target-dir` support in `install` subcommand

4 years agoAuto merge of #8389 - hbina:spelling, r=ehuss
bors [Sat, 20 Jun 2020 19:29:18 +0000 (19:29 +0000)]
Auto merge of #8389 - hbina:spelling, r=ehuss

Correct mispelling of `cargo`.

4 years agoCorrect mispelling of `cargo`.
Hanif Bin Ariffin [Sat, 20 Jun 2020 18:33:20 +0000 (14:33 -0400)]
Correct mispelling of `cargo`.

4 years agoAuto merge of #8386 - crlf0710:master, r=ehuss
bors [Sat, 20 Jun 2020 16:06:52 +0000 (16:06 +0000)]
Auto merge of #8386 - crlf0710:master, r=ehuss

Add missing license field.

Hi, i was playing with `cargo-deny`, and found that it says this crate doesn't have a license field. So i'm going ahead and add it for consistency.

4 years agoAdding environment variable CARGO_PKG_LICENSE_FILE
Robin Moussu [Sat, 20 Jun 2020 10:01:35 +0000 (12:01 +0200)]
Adding environment variable CARGO_PKG_LICENSE_FILE

4 years agoAuto merge of #8325 - kerkmann:license-field-as-environment-variable, r=joshtriplett
bors [Sat, 20 Jun 2020 03:35:31 +0000 (03:35 +0000)]
Auto merge of #8325 - kerkmann:license-field-as-environment-variable, r=joshtriplett

Adding environment variable CARGO_PKG_LICENSE

Fixes #8024

4 years agoAdd missing license field.
CrLF0710 [Sat, 20 Jun 2020 02:03:25 +0000 (10:03 +0800)]
Add missing license field.

4 years agoUse more appropriate basename for the tempdir
Jakub Stasiak [Fri, 19 Jun 2020 13:41:29 +0000 (15:41 +0200)]
Use more appropriate basename for the tempdir

4 years agoMake sure the target tempdir is cleaned if rename fails
Jakub Stasiak [Fri, 19 Jun 2020 13:39:44 +0000 (15:39 +0200)]
Make sure the target tempdir is cleaned if rename fails

4 years agoMake target directory creation and backup exclusion atomic
Jakub Stasiak [Fri, 19 Jun 2020 13:24:51 +0000 (15:24 +0200)]
Make target directory creation and backup exclusion atomic

4 years agoImprove support for non-`master` main branches
Alex Crichton [Mon, 15 Jun 2020 21:06:03 +0000 (14:06 -0700)]
Improve support for non-`master` main branches

This commit improves Cargo's support for git repositories whose "main
branch" is not called `master`. Cargo currently pretty liberally assumes
that if nothing else about a git repository is specified then `master`
is the branch name to use. Instead now Cargo has a fourth option as the
desired reference of a repository named `DefaultBranch`. Cargo doesn't
know anything about the actual name of the default branch, it just
updates how git references are fetched internally.

This commit is motivated by news that GitHub is likely to switch away
from the default branch being named `master` in the near future. It
would be a bit of a bummer if from now on everyone had to type
`branch = '...'`, so this tries to improve that!

4 years agoAuto merge of #8363 - alexcrichton:less-git-data, r=ehuss
bors [Thu, 18 Jun 2020 17:14:16 +0000 (17:14 +0000)]
Auto merge of #8363 - alexcrichton:less-git-data, r=ehuss

Cut down on data fetch from git dependencies

Currently Cargo pretty heavily over-approximates data fetch for git
dependencies. For the index it fetches precisely one branch, but for all
other git dependencies Cargo will fetch all branches and all tags all
the time. In each of these situations, however, Cargo knows if one
branch is desired or if only one tag is desired.

This commit updates Cargo's fetching logic to plumb the desired
`GitReference` all the way down to `fetch`. In that one location we then
determine what to fetch. Namely if a branch or tag is explicitly
selected then we only fetch that one reference from the remote, cutting
down on the amount of traffic to the git remote.

Additionally a bugfix included here is that the GitHub fast path for
checking if a repository is up-to-date now works for non-`master`-based
branch dependencies.

4 years agoFix a test
Jakub Stasiak [Thu, 18 Jun 2020 15:49:36 +0000 (17:49 +0200)]
Fix a test

4 years agoRemove CACHEDIR.TAG as part of cargo clean
Jakub Stasiak [Thu, 18 Jun 2020 14:07:46 +0000 (16:07 +0200)]
Remove CACHEDIR.TAG as part of cargo clean

4 years agoRevert one unintentional change
Jakub Stasiak [Thu, 18 Jun 2020 12:20:36 +0000 (14:20 +0200)]
Revert one unintentional change

4 years agoExclude the target directory from backups using CACHEDIR.TAG
Jakub Stasiak [Thu, 18 Jun 2020 11:43:41 +0000 (13:43 +0200)]
Exclude the target directory from backups using CACHEDIR.TAG

This patch follows the lead of #4386 (which excludes target directories
from Time Machine backups) and is motived by the same reasons listen
in #3884. CACHEDIR.TAG is an OS-independent mechanism supported by Borg,
restic, GNU Tar and other backup/archiving solutions.

See https://bford.info/cachedir/ for more information about the
specification. This has been discussed in Rust Internals earlier this
year[1] and it seems like it's an uncontroversial improvement so I went
ahead with the patch.

[1] https://internals.rust-lang.org/t/pre-rfc-put-cachedir-tag-into-target/12262/11

4 years agoUpdate how locked git commits are fetched
Alex Crichton [Tue, 16 Jun 2020 16:02:01 +0000 (09:02 -0700)]
Update how locked git commits are fetched

This commit refactors various logic of the git source internals to
ensure that if we have a locked revision that we plumb the desired
branch/tag all the way through to the `fetch`. Previously we'd switch to
`Rev` very early on, but the fetching logic for `Rev` is very eager and
fetches too much, so instead we only resolve the locked revision later
on.

Internally this does some various refactoring to try to make various
bits and pieces of logic a bit easyer to grok, although it's still
perhaps not the cleanest implementation.

4 years agoStrip `.git` from urls on GitHub fast-path
Alex Crichton [Tue, 16 Jun 2020 15:31:19 +0000 (08:31 -0700)]
Strip `.git` from urls on GitHub fast-path

4 years agoCut down on data fetch from git dependencies
Alex Crichton [Mon, 15 Jun 2020 20:36:23 +0000 (13:36 -0700)]
Cut down on data fetch from git dependencies

Currently Cargo pretty heavily over-approximates data fetch for git
dependencies. For the index it fetches precisely one branch, but for all
other git dependencies Cargo will fetch all branches and all tags all
the time. In each of these situations, however, Cargo knows if one
branch is desired or if only one tag is desired.

This commit updates Cargo's fetching logic to plumb the desired
`GitReference` all the way down to `fetch`. In that one location we then
determine what to fetch. Namely if a branch or tag is explicitly
selected then we only fetch that one reference from the remote, cutting
down on the amount of traffic to the git remote.

Additionally a bugfix included here is that the GitHub fast path for
checking if a repository is up-to-date now works for non-`master`-based
branch dependencies.

4 years agoAuto merge of #8359 - ehuss:doctest-xcompile-linker, r=alexcrichton
bors [Mon, 15 Jun 2020 14:38:34 +0000 (14:38 +0000)]
Auto merge of #8359 - ehuss:doctest-xcompile-linker, r=alexcrichton

Support linker with -Zdoctest-xcompile.

This adds support for `-Clinker` with `-Zdoctest-xcompile`.

I'm not entirely sure how `-Zdoctest-xcompile` was supposed to work without setting the linker. I tested this with std on arm-unknown-linux-gnueabihf with qemu. It seems to work (although it was quite slow).

Closes #7529.

4 years agoAuto merge of #8358 - ehuss:fix-target-host-doctest, r=alexcrichton
bors [Mon, 15 Jun 2020 14:05:10 +0000 (14:05 +0000)]
Auto merge of #8358 - ehuss:fix-target-host-doctest, r=alexcrichton

Fix doctests not running with --target=HOST.

There was a regression in #8167 where `cargo test --target=$HOST` stopped running doctests. This caused doctests to silently stop running in rust-lang/rust (https://github.com/rust-lang/rust/issues/73286).  This PR restores the original behavior where `--target=$HOST` behaves as-if it is a normal host test.

There was a discussion about this at https://github.com/rust-lang/cargo/pull/8167#pullrequestreview-402196323, but I think I let it slip through the cracks.

4 years agoAuto merge of #8344 - kellda:install-index-flag, r=ehuss
bors [Sun, 14 Jun 2020 18:32:58 +0000 (18:32 +0000)]
Auto merge of #8344 - kellda:install-index-flag, r=ehuss

Allow passing a registry index url directly to `cargo install`

Fixes #8318

4 years agoAdd --index to `install` man page.
Eric Huss [Sun, 14 Jun 2020 18:30:48 +0000 (11:30 -0700)]
Add --index to `install` man page.

4 years agoSupport linker with -Zdoctest-xcompile.
Eric Huss [Sun, 14 Jun 2020 04:19:22 +0000 (21:19 -0700)]
Support linker with -Zdoctest-xcompile.

4 years agoFix doctests not running with --target=HOST.
Eric Huss [Sun, 14 Jun 2020 03:56:29 +0000 (20:56 -0700)]
Fix doctests not running with --target=HOST.

4 years agoUpdate src/doc/src/reference/manifest.md
naerbnic [Fri, 12 Jun 2020 00:01:19 +0000 (17:01 -0700)]
Update src/doc/src/reference/manifest.md

Add a link to the mdbook generated link

Co-authored-by: Eric Huss <eric@huss.org>
4 years agoUpdate src/doc/src/reference/workspaces.md
naerbnic [Fri, 12 Jun 2020 00:01:03 +0000 (17:01 -0700)]
Update src/doc/src/reference/workspaces.md

Remove anchor to use the mdbook generated link instead.

Co-authored-by: Eric Huss <eric@huss.org>
4 years agoAuto merge of #8353 - ehuss:fix-missing-readme, r=alexcrichton
bors [Thu, 11 Jun 2020 22:13:37 +0000 (22:13 +0000)]
Auto merge of #8353 - ehuss:fix-missing-readme, r=alexcrichton

Fix failure with missing readme.

#8277 added implicit README support, but it also rejected parsing any manifest where the README was missing.  This causes a problem because the README is often missing in many registry packages (for various reasons).

This removes the validation at parsing time.  Cargo has historically not had hard enforcement at the parsing stage.  Whether or not the readme exists has always been enforced during publishing. I have added some extra context to the error message, and added a test to that effect.

Fixes #8351

4 years agoFix failure with missing readme.
Eric Huss [Thu, 11 Jun 2020 21:55:33 +0000 (14:55 -0700)]
Fix failure with missing readme.

4 years agoAuto merge of #8349 - ehuss:fix-lto, r=alexcrichton
bors [Thu, 11 Jun 2020 15:34:15 +0000 (15:34 +0000)]
Auto merge of #8349 - ehuss:fix-lto, r=alexcrichton

Some LTO fixes.

This reworks the LTO computation a little to address a few issues:

- `cargo build` in a project with both a lib and bin would not engage the optimization introduced in #8192 where the lib *should* be compiled with `-C linker-plugin-lto` (bitcode only). This happened because the old code was starting root units as `Lto::None`. The solution here is to conditionally choose the starting Lto for roots.
- A project with a dylib dependency would fail to build. It was building the dylib with `-C linker-plugin-lto` which is not valid.
- A project with a bin/lib would build the lib differently based on whether or not it was selected. This changes it so that the lib is built the same. See `lto::between_builds`, where the second build the lib is now fresh.
- Tests/benchmarks of a `lib` target will now support LTO.
- Treats example libs a little more consistently as regular libs.

I scattered some comments throughout, hopefully it's not too difficult to follow.

Closes #8337

4 years agoSome LTO fixes.
Eric Huss [Wed, 10 Jun 2020 22:31:36 +0000 (15:31 -0700)]
Some LTO fixes.

4 years agoAdd test for `cargo install --index`
kellda [Wed, 10 Jun 2020 15:21:37 +0000 (15:21 +0000)]
Add test for `cargo install --index`

4 years agoAuto merge of #8277 - tverghis:default-readme, r=alexcrichton
bors [Tue, 9 Jun 2020 20:03:14 +0000 (20:03 +0000)]
Auto merge of #8277 - tverghis:default-readme, r=alexcrichton

Default values for `readme` if not specified

If the a value for `readme` is not specified in Cargo.toml, we will now check for the existence of files named `README.md`, `README.txt` or `README`. If one does exist, the name of that file will be defaulted in to the manifest for the project.

This behavior can be suppressed if `readme` is set to `false`.

Closes #8133

4 years agoCreate README file so tests pass
Tarun Verghis [Tue, 9 Jun 2020 07:15:28 +0000 (00:15 -0700)]
Create README file so tests pass

4 years agoAssume README.md if readme=true
Tarun Verghis [Tue, 9 Jun 2020 07:03:15 +0000 (00:03 -0700)]
Assume README.md if readme=true

4 years agoMerge branch 'master' into license-field-as-environment-variable
Daniél Kerkmann [Mon, 8 Jun 2020 19:24:02 +0000 (21:24 +0200)]
Merge branch 'master' into license-field-as-environment-variable

4 years agoAuto merge of #8342 - ehuss:fix-tree-completions, r=alexcrichton
bors [Mon, 8 Jun 2020 14:47:36 +0000 (14:47 +0000)]
Auto merge of #8342 - ehuss:fix-tree-completions, r=alexcrichton

Fix tree completions.

During #8062, the flags were changed, but the completions weren't updated.

Fixes #8330