]> git.proxmox.com Git - cargo.git/log
cargo.git
4 years agoRemove unused CompileMode::all_modes
Tomasz Miąsko [Wed, 22 Jul 2020 00:00:00 +0000 (00:00 +0000)]
Remove unused CompileMode::all_modes

4 years agoAuto merge of #8510 - jsha:patch-1, r=ehuss
bors [Sat, 18 Jul 2020 23:47:01 +0000 (23:47 +0000)]
Auto merge of #8510 - jsha:patch-1, r=ehuss

doc: Replace "regenerate" with "revoke" for API tokens

The current UI supports revoking tokens and creating new ones, not regenerating them.

4 years agoReplace "regenerate" with "revoke" for API tokens
Jacob Hoffman-Andrews [Sat, 18 Jul 2020 23:39:23 +0000 (16:39 -0700)]
Replace "regenerate" with "revoke" for API tokens

The current UI supports revoking tokens and creating new ones, not regenerating them.

4 years agoAuto merge of #8494 - lu-zero:unbreak-cargo-c, r=ehuss
bors [Sat, 18 Jul 2020 03:14:53 +0000 (03:14 +0000)]
Auto merge of #8494 - lu-zero:unbreak-cargo-c, r=ehuss

Add back Manifest::targets_mut

It is needed by cargo-c, it was removed in df5cb70e7bc8872216af736f108f5a959a6d2302

4 years agoAuto merge of #8500 - alexcrichton:build-override-opt-level-0, r=Eh2406
bors [Fri, 17 Jul 2020 20:21:25 +0000 (20:21 +0000)]
Auto merge of #8500 - alexcrichton:build-override-opt-level-0, r=Eh2406

Build host dependencies with opt-level 0 by default

This commit updates Cargo's build of host dependencies to build them
with optimization level 0 by default instead of matching the profile of
the final binary.

Since Cargo's inception build dependencies have, by default, been built
in a profile that largely matches the profile of the final target
artifact. Build dependencies, however, rarely actually need to be
optimized and are often executing very small tasks, which means that
optimizing them often wastes a lot of build time. A great example of
this is procedural macros where `syn` and friends are pretty heavyweight
to optimize, and the amount of Rust code they're parsing is typically
quite small, so the time spent optimizing rarely comes as a benefit.

The goal of this PR is to improve build times on average in the
community by not spending time optimizing build dependencies (build
scripts, procedural macros, and their transitive dependencies). The PR
will not be a universal win for everyone, however. There's some
situations where your build time may actually increase:

* In some cases build scripts and procedural macros can take quite a
  long time to run!
* Cargo may not build dependencies more than once if they're shared with
  the main build. This only applies to builds without `--target` where
  the same crate is used in the final binary as in a build script.

In these cases, however, the `build-override` profile has existed for
some time know and allows giving a knob to tweak this behavior. For
example to get back the previous build behavior of Cargo you would
specify, in `Cargo.toml`:

    [profile.release.build-override]
    opt-level = 3

or you can configure this via the environment:

    export CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_OPT_LEVEL=3

There are two notable features we would like to add in the future which
would make the impact of a change like this smaller, but they're not
implemented at this time (nor do we have concrete plans to implement
them). First we would like crates to have a way of specifying they
should be optimized by default, despite default profile options. Often
crates, like lalrpop historically, have abysmal performance in debug
mode and almost always (even in debug builds) want to be built in
release mode. The second feature is that ideally crate authors would be
able to tell Cargo to minimize the number of crates built, unifying
profiles where possible to avoid double-compiling crates.

At this time though the Cargo team feels that the benefit of changing
the defaults is well worth this change. Neither today nor directly after
this change will be a perfect world, but it's hoped that this change
makes things less bad!

4 years agoBuild host dependencies with opt-level 0 by default
Alex Crichton [Fri, 17 Jul 2020 19:39:41 +0000 (12:39 -0700)]
Build host dependencies with opt-level 0 by default

This commit updates Cargo's build of host dependencies to build them
with optimization level 0 by default instead of matching the profile of
the final binary.

Since Cargo's inception build dependencies have, by default, been built
in a profile that largely matches the profile of the final target
artifact. Build dependencies, however, rarely actually need to be
optimized and are often executing very small tasks, which means that
optimizing them often wastes a lot of build time. A great example of
this is procedural macros where `syn` and friends are pretty heavyweight
to optimize, and the amount of Rust code they're parsing is typically
quite small, so the time spent optimizing rarely comes as a benefit.

The goal of this PR is to improve build times on average in the
community by not spending time optimizing build dependencies (build
scripts, procedural macros, and their transitive dependencies). The PR
will not be a universal win for everyone, however. There's some
situations where your build time may actually increase:

* In some cases build scripts and procedural macros can take quite a
  long time to run!
* Cargo may not build dependencies more than once if they're shared with
  the main build. This only applies to builds without `--target` where
  the same crate is used in the final binary as in a build script.

In these cases, however, the `build-override` profile has existed for
some time know and allows giving a knob to tweak this behavior. For
example to get back the previous build behavior of Cargo you would
specify, in `Cargo.toml`:

    [profile.release.build-override]
    opt-level = 3

or you can configure this via the environment:

    export CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_OPT_LEVEL=3

There are two notable features we would like to add in the future which
would make the impact of a change like this smaller, but they're not
implemented at this time (nor do we have concrete plans to implement
them). First we would like crates to have a way of specifying they
should be optimized by default, despite default profile options. Often
crates, like lalrpop historically, have abysmal performance in debug
mode and almost always (even in debug builds) want to be built in
release mode. The second feature is that ideally crate authors would be
able to tell Cargo to minimize the number of crates built, unifying
profiles where possible to avoid double-compiling crates.

At this time though the Cargo team feels that the benefit of changing
the defaults is well worth this change. Neither today nor directly after
this change will be a perfect world, but it's hoped that this change
makes things less bad!

4 years agoAuto merge of #8497 - alexcrichton:fix-rebuild-on-rename, r=ehuss
bors [Fri, 17 Jul 2020 19:30:46 +0000 (19:30 +0000)]
Auto merge of #8497 - alexcrichton:fix-rebuild-on-rename, r=ehuss

Fix freshness checks for build scripts on renamed dirs

This commit fixes an issue in Cargo where when an entire project
directory is renamed (preserving the target directory) then path
dependencies with build scripts would have their build scripts rereun
when building again. The problem with this was that when a build script
doesn't print `rerun-if-changed` Cargo's conservative fingerprint listed
an absolute path in it, which was intended to be a relative path.

The fix here is to use a relative path in the fingerprint to ensure that
it's not the reason a rebuild happens when directories are renamed.

4 years agoFix freshness checks for build scripts on renamed dirs
Alex Crichton [Fri, 17 Jul 2020 17:07:06 +0000 (10:07 -0700)]
Fix freshness checks for build scripts on renamed dirs

This commit fixes an issue in Cargo where when an entire project
directory is renamed (preserving the target directory) then path
dependencies with build scripts would have their build scripts rereun
when building again. The problem with this was that when a build script
doesn't print `rerun-if-changed` Cargo's conservative fingerprint listed
an absolute path in it, which was intended to be a relative path.

The fix here is to use a relative path in the fingerprint to ensure that
it's not the reason a rebuild happens when directories are renamed.

4 years agoAdd back Manifest::targets_mut
Luca Barbato [Fri, 17 Jul 2020 07:58:09 +0000 (09:58 +0200)]
Add back Manifest::targets_mut

It is needed by cargo-c, it was removed in df5cb70e7bc8872216af736f108f5a959a6d2302

4 years agoAuto merge of #8490 - alexcrichton:std-customize-features, r=ehuss
bors [Fri, 17 Jul 2020 15:22:03 +0000 (15:22 +0000)]
Auto merge of #8490 - alexcrichton:std-customize-features, r=ehuss

Add a `-Zbuild-std-features` flag

This flag is intended to pair with `-Zbuild-std` as necessary to
configure the features that libstd is built with. This is highly
unlikely to ever be stabilized in any form (unlike `-Zbuild-std` which
we'd like to stabilize at some point), but can be useful for
experimenting with the standard library. For example today it can be
used to test changes to binary size by disabling backtraces.

My intention is that we won't need a `--no-default-features` equivalent
for libstd, where after rust-lang/rust#74377 is merged we can
unconditionally specify default features are disabled but the default
set of features lists `default`. That way if users want to override the
list *and* include the default feature, they can just be sure to include
`default`.

4 years agoAdd a `-Zbuild-std-features` flag
Alex Crichton [Wed, 15 Jul 2020 18:44:41 +0000 (11:44 -0700)]
Add a `-Zbuild-std-features` flag

This flag is intended to pair with `-Zbuild-std` as necessary to
configure the features that libstd is built with. This is highly
unlikely to ever be stabilized in any form (unlike `-Zbuild-std` which
we'd like to stabilize at some point), but can be useful for
experimenting with the standard library. For example today it can be
used to test changes to binary size by disabling backtraces.

My intention is that we won't need a `--no-default-features` equivalent
for libstd, where after rust-lang/rust#74377 is merged we can
unconditionally specify default features are disabled but the default
set of features lists `default`. That way if users want to override the
list *and* include the default feature, they can just be sure to include
`default`.

4 years agoAuto merge of #8495 - matthiaskrgr:clippy_v15, r=Eh2406
bors [Fri, 17 Jul 2020 13:55:20 +0000 (13:55 +0000)]
Auto merge of #8495 - matthiaskrgr:clippy_v15, r=Eh2406

clippy cleanups

Fixes a couple of clippy warnings.
Ignores clippy::collapsible_if warnings in the future (iirc there were not desired)
clippy::redundant_clone is enabled by default by clippy already.

4 years agofix clippy warnings
Matthias Krüger [Fri, 17 Jul 2020 10:09:21 +0000 (12:09 +0200)]
fix clippy warnings

4 years agoclippy lints: redundant_clone is on by default, allow clippy::collapsible_if
Matthias Krüger [Fri, 17 Jul 2020 09:56:44 +0000 (11:56 +0200)]
clippy lints: redundant_clone is on by default, allow clippy::collapsible_if

4 years agoAuto merge of #8492 - ehuss:fix-publish-py, r=alexcrichton
bors [Thu, 16 Jul 2020 22:26:51 +0000 (22:26 +0000)]
Auto merge of #8492 - ehuss:fix-publish-py, r=alexcrichton

Fix self-publish script.

Removes the dry run, since it won't work (verification fails since dependencies aren't actually published).

Also adds a sleep in-between publishing to give the index a moment to update.

4 years agoFix self-publish script.
Eric Huss [Thu, 16 Jul 2020 22:21:51 +0000 (15:21 -0700)]
Fix self-publish script.

4 years agoAuto merge of #8491 - alexcrichton:fix-unstable-build-std-config, r=Eh2406
bors [Thu, 16 Jul 2020 17:12:38 +0000 (17:12 +0000)]
Auto merge of #8491 - alexcrichton:fix-unstable-build-std-config, r=Eh2406

Ensure `unstable.build-std` works like `-Zbuild-std`

This fixes an issue where the deserializer for `-Zbuild-std` was a bit
fancier than the `unstable.build-std` directive.

cc #8393

4 years agoEnsure `unstable.build-std` works like `-Zbuild-std`
Alex Crichton [Thu, 16 Jul 2020 15:49:04 +0000 (08:49 -0700)]
Ensure `unstable.build-std` works like `-Zbuild-std`

This fixes an issue where the deserializer for `-Zbuild-std` was a bit
fancier than the `unstable.build-std` directive.

cc #8393

4 years agoAuto merge of #8489 - arlosi:deterministic_metadata, r=alexcrichton
bors [Thu, 16 Jul 2020 15:35:49 +0000 (15:35 +0000)]
Auto merge of #8489 - arlosi:deterministic_metadata, r=alexcrichton

Make `cargo metadata` output deterministic

Uses BTreeMap instead of HashMap for the `cargo metadata` command, ensuring the output is sorted.

The change did not cause a measurable performance impact for running `cargo metadata` on `cargo` itself.

Fixes #8477

4 years agoStop ignoring Array ordering Json comparison tests. Update tests to have sorted order.
Arlo Siemsen [Wed, 15 Jul 2020 23:22:28 +0000 (16:22 -0700)]
Stop ignoring Array ordering Json comparison tests. Update tests to have sorted order.

4 years agoMake `cargo metadata` output deterministic
Arlo Siemsen [Wed, 15 Jul 2020 17:43:34 +0000 (10:43 -0700)]
Make `cargo metadata` output deterministic

Uses BTreeMap instead of HashMap for the `cargo metadata` command.
The change did not cause a measurable performance impact for
running `cargo metadata` on `cargo` itself.

Fixes #8477

4 years agoAuto merge of #8467 - alexcrichton:gha, r=ehuss
bors [Wed, 15 Jul 2020 14:45:12 +0000 (14:45 +0000)]
Auto merge of #8467 - alexcrichton:gha, r=ehuss

Switch to github actions

This commit switches our CI from Azure Pipelines to GitHub Actions. The intention here is to follow the "idiomatic" provider of CI for rust-lang, and otherwise GitHub Actions is better integrated with GitHub's UI right now too.

I'll need to tweak bors to actually `@bors: r+` this to have it successfully get merged, but I think it'd be good to get some review first.

4 years agoSwitch to github actions
Alex Crichton [Tue, 30 Jun 2020 17:54:30 +0000 (10:54 -0700)]
Switch to github actions

4 years agoAuto merge of #8476 - Rustin-Liu:rustin-patch, r=ehuss
bors [Mon, 13 Jul 2020 17:35:42 +0000 (17:35 +0000)]
Auto merge of #8476 - Rustin-Liu:rustin-patch, r=ehuss

fix: add space to comments

4 years agofix: refine test
Rustin-Liu [Sat, 11 Jul 2020 02:36:49 +0000 (10:36 +0800)]
fix: refine test

4 years agofix: add space to comments
Rustin-Liu [Fri, 10 Jul 2020 16:16:21 +0000 (00:16 +0800)]
fix: add space to comments

4 years agoAuto merge of #8393 - ludumipsum:unstable_flags_in_config, r=alexcrichton
bors [Thu, 9 Jul 2020 23:47:33 +0000 (23:47 +0000)]
Auto merge of #8393 - ludumipsum:unstable_flags_in_config, r=alexcrichton

Allow configuring unstable flags via config file

# Summary

This fixes #8127 by mapping the `unstable` key in `.cargo/config` to Z flags.

It should have no impact on stable/beta cargo, and on nightlies it gives folks the ability to configure Z flags for an entire project or workspace. This is meant to make it easier to try things like the [new features resolver](https://github.com/rust-lang/cargo/issues/8088) behavior, mtime-on-use, build-std, or timing reports across a whole project.

I've also included a small (but entirely independent) ergonomics change -- treating dashes and underscores identically in Z flags. That's along for the ride in this PR as the last commit, and is included here because it makes for more idiomatic toml file keys (`print_im_a_teapot = yes` vs `print-im-a-teapot = yes`). Please let me know if y'all would prefer that be in a separate PR, or not happen at all.

# Test Plan

Apologies if I've missed anything -- this is my first cargo contrib and I've tried to hew to the contributing guide. If I've slipped up, please let me know how and I'll fix it.

NB. My linux machine doesn't have multilib set up, so I disabled cross tests.

 * `cargo test` passes for each commit in the stack
 * I formatted each commit in the stack with `rustfmt`
 * New tests are included alongside the relevant change for each change
 * I've validated each test by locally undoing the code change they support and confirming failure.
 * The CLI wins, for both enable and disabling Z flags, as you'd expect.

Keys in `unstable` which do not correspond with a Z flag will trigger an error indicating the invalid flag came from a config file read:

```
Invalid [unstable] entry in Cargo config

Caused by:
  unknown `-Z` flag specified: an-invalid-flag
```

If you'd like to see a test case which isn't represented here, I'm happy to add it. Just let me know.

# Documentation

I've included commits in this stack updating the only docs page that seemed relevant to me, skimming the book -- `unstable.md`.

4 years agoFix tests for handling env key overlaps / errors
Alex Berghage [Thu, 9 Jul 2020 19:12:34 +0000 (13:12 -0600)]
Fix tests for handling env key overlaps / errors

4 years agoAdd tests verifying overlapping prefixes and defaults
Alex Berghage [Thu, 9 Jul 2020 18:53:42 +0000 (12:53 -0600)]
Add tests verifying overlapping prefixes and defaults

These tests demonstrate the current failure mode around
overlapping env keys and inner structs. To some extent this
is a limitation of mapping on to environment variables with
an underscore as both the namespace separator and the
substitute for dashes in flag names in that the mapping is
not strictly one-to-one.

4 years agoAuto merge of #8427 - davidtwco:terminal-width, r=ehuss
bors [Thu, 9 Jul 2020 16:16:56 +0000 (16:16 +0000)]
Auto merge of #8427 - davidtwco:terminal-width, r=ehuss

Add support for rustc's `-Z terminal-width`.

This PR continues the work started in #7315, adding support for rustc's `-Z terminal-width` flag, which is used to trim diagnostic output to fit within the current terminal and was added in rust-lang/rust#63402 (with JSON emitter support in rust-lang/rust#73763).

At the time of writing, rust-lang/rust#73763 isn't in nightly, so the test added in this PR will fail, but it should pass tomorrow (I've confirmed that it works with a local rustc build).

cc @estebank

4 years agoAuto merge of #8473 - alexcrichton:fix-fingerprint-loc, r=ehuss
bors [Thu, 9 Jul 2020 15:50:43 +0000 (15:50 +0000)]
Auto merge of #8473 - alexcrichton:fix-fingerprint-loc, r=ehuss

Avoid colliding with older Cargo fingerprint changes

The fingerprint format Cargo stores changed recently in a way that
older Cargos cannot understand. Unfortunately though older Cargos are
colliding on some compilation units trying to read the new format and
they're bailing out. This commit fixes this issue by ensuring that the
location for fingerprint metadata is different in older Cargos and newer
Cargos.

Fingerprint metadata is always stored in a location with a hash in the
file name. This hash typically includes the hash of rustc's version
information itself, but for units which don't have a `Metadata` it's a
much simpler hash which is much more likely to collide with other
versions of Cargo. The fix in this commit is to extract the metadata
version that we're hashing to a constant, and then also hash it for
generating a filesystem location to house fingerprint data for a unit
that has no `Metadata`.

Closes #8472
Closes #8298

4 years agoAvoid colliding with older Cargo fingerprint changes
Alex Crichton [Thu, 9 Jul 2020 14:48:18 +0000 (07:48 -0700)]
Avoid colliding with older Cargo fingerprint changes

The fingerprint format Cargo stores changed recently in a way that
older Cargos cannot understand. Unfortunately though older Cargos are
colliding on some compilation units trying to read the new format and
they're bailing out. This commit fixes this issue by ensuring that the
location for fingerprint metadata is different in older Cargos and newer
Cargos.

Fingerprint metadata is always stored in a location with a hash in the
file name. This hash typically includes the hash of rustc's version
information itself, but for units which don't have a `Metadata` it's a
much simpler hash which is much more likely to collide with other
versions of Cargo. The fix in this commit is to extract the metadata
version that we're hashing to a constant, and then also hash it for
generating a filesystem location to house fingerprint data for a unit
that has no `Metadata`.

Closes #8472

4 years agoIntroduce `TtyWidth`
David Wood [Thu, 2 Jul 2020 11:00:54 +0000 (12:00 +0100)]
Introduce `TtyWidth`

This commit introduces a `TtyWidth` enum which enables better handling
of the tty-width on Windows.

Signed-off-by: David Wood <david@davidtw.co>
4 years agofix docs to drop reverted change
Alex Berghage [Thu, 9 Jul 2020 04:11:05 +0000 (22:11 -0600)]
fix docs to drop reverted change

4 years agofix nightly rustdoc-extern tests
Alex Berghage [Thu, 9 Jul 2020 04:05:52 +0000 (22:05 -0600)]
fix nightly rustdoc-extern tests

4 years agoclearer comment on doubleparse of cli flags
Alex Berghage [Thu, 9 Jul 2020 03:33:35 +0000 (21:33 -0600)]
clearer comment on doubleparse of cli flags

4 years agoMinor test fix (error text comparison)
Alex Berghage [Thu, 9 Jul 2020 03:22:44 +0000 (21:22 -0600)]
Minor test fix (error text comparison)

Serde's errors for missing fields are a lil' different than
the ones from our Deserializer.

4 years agoRevert workaround and patch Deserializer
Alex Berghage [Thu, 9 Jul 2020 03:14:47 +0000 (21:14 -0600)]
Revert workaround and patch Deserializer

This patch changes how ConfigMapAccess iterates k/v pairs when
deserializing structs.

Previously we produced keys for exactly the set of fields needed
for a struct, and errored out in the deserializer if we can't find
anything for that field.

This patch makes us produces keys from the union of two sets:

1. All fields that are both needed for the struct and can be found
   in the environment.
2. All fields in the config table.

This change allows serde's codegen to handle both missing and
unknown fields via the usual derive annotations (default or
deny_unknown_fields respectively)

4 years agoAuto merge of #8469 - ehuss:long-filename-windows, r=alexcrichton
bors [Wed, 8 Jul 2020 17:13:00 +0000 (17:13 +0000)]
Auto merge of #8469 - ehuss:long-filename-windows, r=alexcrichton

Disable long_file_names test if not supported on Windows.

This test will fail on Windows if Cargo's target directory is over 80 characters long (as it is in rust's CI).

4 years agoDisable long_file_names test if not supported on Windows.
Eric Huss [Wed, 8 Jul 2020 16:23:59 +0000 (09:23 -0700)]
Disable long_file_names test if not supported on Windows.

4 years agoAdd documentation for `-Z terminal-width`
David Wood [Tue, 30 Jun 2020 19:37:50 +0000 (20:37 +0100)]
Add documentation for `-Z terminal-width`

This commit adds relevant documentation for the `-Z terminal-width`
flag.

Signed-off-by: David Wood <david@davidtw.co>
4 years agoMake `-Z terminal-width` opt-in.
David Wood [Tue, 30 Jun 2020 19:29:09 +0000 (20:29 +0100)]
Make `-Z terminal-width` opt-in.

This commit modifies the parsing of `-Z terminal-width` so that it can
optionally take a value and only uses `accurate_err_width` when the user
does not provide a value - therefore making the emission of `-Z
terminal-width` opt-in.

Signed-off-by: David Wood <david@davidtw.co>
4 years agoAdd support for rustc's `-Z terminal-width`.
Esteban Küber [Sat, 31 Aug 2019 02:51:55 +0000 (19:51 -0700)]
Add support for rustc's `-Z terminal-width`.

This commit adds support for rustc's `-Z terminal-width` flag, which is
used to trim diagnostic output to fit within the current terminal.

Co-authored-by: David Wood <david@davidtw.co>
Signed-off-by: David Wood <david@davidtw.co>
4 years agoDrop broken test asserting invalid configs error on nightly
Alex Berghage [Wed, 8 Jul 2020 05:35:22 +0000 (23:35 -0600)]
Drop broken test asserting invalid configs error on nightly

The current behavior, with the default-false workaround in place,
is not able to identify extra members of the `unstable` table, so
it can't error on unexpected members.

I'll add this test back in with a Deserializer refactor to clean up
the extra logic added to CliUnstable.

4 years agoTreat all CliUnstable values as default-false
Alex Berghage [Wed, 8 Jul 2020 05:34:04 +0000 (23:34 -0600)]
Treat all CliUnstable values as default-false

This is a workaround in case y'all would like to land this change
before I'm able to finish up a Deserializer refactor.

4 years ago[fixup] use single-line serde annotations
Alexander Berghage [Fri, 3 Jul 2020 00:39:01 +0000 (18:39 -0600)]
[fixup] use single-line serde annotations

4 years agoSwitch unstable config parsing to serde
Alexander Berghage [Tue, 30 Jun 2020 02:13:50 +0000 (20:13 -0600)]
Switch unstable config parsing to serde

Tests are currently failing, looks like there's something in the
Deserializer impl that's forcing field-missing errors even when
the serde `default` annotation is applied.

4 years agoRevert misfeatures
Alexander Berghage [Tue, 30 Jun 2020 01:47:21 +0000 (19:47 -0600)]
Revert misfeatures

Per comments on the PR, a couple changes need to be backed out.

4 years agoClarify CliUnstable::parse/update_with_table
Alex Berghage [Wed, 24 Jun 2020 23:42:51 +0000 (17:42 -0600)]
Clarify CliUnstable::parse/update_with_table

These masquerade like construction functions, but they're
in-place mutators since they're meant to be used one after
another in a precedence chain.

4 years agoUpdate src/doc/src/reference/unstable.md
Alex Berghage [Wed, 24 Jun 2020 23:30:37 +0000 (17:30 -0600)]
Update src/doc/src/reference/unstable.md

Co-authored-by: Eric Huss <eric@huss.org>
4 years agoAllow both dashes and underscores for Z flags
Alex Berghage [Sun, 21 Jun 2020 20:18:44 +0000 (14:18 -0600)]
Allow both dashes and underscores for Z flags

This makes it a little easier to match whatever
the natural formatting is for where you're setting
unstable options -- CLI or config file.

4 years agoAllow setting unstable options in .cargo/config
Alex Berghage [Sun, 21 Jun 2020 20:19:37 +0000 (14:19 -0600)]
Allow setting unstable options in .cargo/config

Obviously this only works with nightlies and all
that, but if you're e.g. testing resolver v2, want
to always have Ztiming on in your workspace, or
something like that, this makes it easier to do.

4 years agoAllow populating CliUnstable from a HashMap
Alex Berghage [Sun, 21 Jun 2020 20:16:00 +0000 (14:16 -0600)]
Allow populating CliUnstable from a HashMap

This makes it easier to populate unstable
options from configuration files. Might also
help make unstable option tests easier to write.

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).