9048 Commits

Author SHA1 Message Date
Josh Stone
9c8b4dcd3e Link the licenses into crates/cargo-platform
The licenses should be included in the package published on crates.io
2020-02-14 15:54:22 -08:00
bors
a491aa7179 Auto merge of #7883 - estebank:change-test, r=ehuss
Modify test to make `rustc` PR mergeable

Modify a test to be less succeptible to failure for wording changes.
2020-02-12 22:22:30 +00:00
Esteban Küber
e0787ec2b3 Modify test to make rustc PR mergeable
Modify a test to be less succeptible to failure for wording changes.
2020-02-12 13:45:09 -08:00
bors
c31bd9d8ac Auto merge of #7877 - joshtriplett:env-order, r=ehuss
Keep environment variables in a BTreeMap to preserve sort order

This prevents verbose output from varying between runs due to HashMap
(non-)ordering.
2020-02-11 17:57:42 +00:00
Josh Triplett
e84a4ed6d0 Keep environment variables in a BTreeMap to preserve sort order
This prevents verbose output from varying between runs due to HashMap
(non-)ordering.
2020-02-10 13:00:33 -08:00
bors
3c53211c3d Auto merge of #7857 - ehuss:fix-build-script-dupe, r=alexcrichton
Fix BuildScriptOutput when a build script is run multiple times.

When I implemented profile build overrides, I created a scenario where a build script could run more than once for different scenarios.  See the test for an example.

However, the `BuildScriptOutputs` map did not take this into consideration.  This caused multiple build script runs to stomp on the output of previous runs.  This is further exacerbated by the new feature resolver in #7820 where build scripts can run with different features enabled.

The solution is to make the map key unique for the Unit it is running for.  Since this map must be updated on different threads, `Unit` cannot be used as a key, so I chose just using the metadata hash which is hopefully unique.  Most of this patch is involved with the fussiness of getting the correct metadata hash (we want the RunCustomBuild unit's hash).  I also added some checks to avoid collisions and assert assumptions.
2020-02-07 15:35:03 +00:00
bors
1bc7f53139 Auto merge of #7875 - ehuss:update-jobserver, r=alexcrichton
Update jobserver.

Keep in sync with rust-lang/rust (https://github.com/rust-lang/rust/pull/68663), so that local users and lib users get the same version.
2020-02-06 20:44:26 +00:00
bors
23ce747f93 Auto merge of #7874 - ehuss:update-tar, r=Eh2406
Update tar.

Updates to the latest tar.  rust-lang/rust is currently on 0.4.20.  The change I'm most interested in is fixing the TarError cause/source, so that Cargo reports a better error message.  Compare:

```
Caused by:
  failed to unpack `/…/registry/src/github.com-1ecc6299db9ec823/curl-sys-0.4.25/curl/docs/libcurl/libcurl-multi.3`
```

to the new version:

```
Caused by:
  failed to unpack `curl-sys-0.4.25/curl/docs/libcurl/libcurl-multi.3` into `/…/registry/src/github.com-1ecc6299db9ec823/curl-sys-0.4.25/curl/docs/libcurl/libcurl-multi.3`

Caused by:
  No space left on device (os error 28)
```
2020-02-06 19:38:30 +00:00
Eric Huss
8f09ac0c0b Update jobserver. 2020-02-06 11:30:07 -08:00
Eric Huss
635c423031 Update tar. 2020-02-06 11:29:07 -08:00
bors
c55d3636c8 Auto merge of #7872 - ehuss:timings-error, r=Eh2406
Emit report on error with Ztimings.

Previously the report was not saved on error.

I'm not actually sure this is all that useful.  I was using it to gather a picture of what was being built (I wasn't actually interested in the timing data).  There might be better ways to accomplish what I wanted, but it's a small change, so probably doesn't hurt.

Fixes #7413.
2020-02-06 18:57:21 +00:00
Eric Huss
2061e86612 Emit report on error with Ztimings. 2020-02-06 10:45:22 -08:00
bors
db0dac507e Auto merge of #7827 - Kinrany:7656-format-placeholder-code-when-generating-a-crate, r=ehuss
Format placeholder code when generating a crate

When generating source files in `cargo new` and `cargo init`, try to run `rustfmt` CLI on them.

If it fails, log the error and proceed.

Tests:
* Works for `cargo init --lib`
* No changes in behavior if `rustfmt` is missing

Closes #7656
2020-02-05 16:50:49 +00:00
Kinrany
bc4c65c5d3 Do not run formats_source if rustfmt is not available
Generalized `clippy_is_available` and renamed as `command_is_available`.

No checks in `ignores_failure_to_format_source`, it's not supposed to
use `rustfmt` even if it's available
2020-02-05 10:09:43 +03:00
bors
19d38e5575 Auto merge of #7865 - ehuss:fix-rebuild_sub_package_then_while_package, r=alexcrichton
Fix rebuild_sub_package_then_while_package on HFS.

This test was flaky on HFS ([azure failure](https://dev.azure.com/rust-lang/cargo/_build/results?buildId=20144&view=logs&j=a5e52b91-c83f-5429-4a68-c246fc63a4f7&t=d4864165-4be3-5e34-b483-a6b05303aa68&l=2018)), resulting in this error:

```
   Compiling foo v0.0.1 (/Users/runner/runners/2.164.7/work/1/s/target/cit/t750/foo)
error[E0460]: found possibly newer version of crate `b` which `a` depends on
 --> src/lib.rs:1:1
  |
1 | extern crate a; extern crate b; pub fn toplevel() {}
  | ^^^^^^^^^^^^^^^
  |
  = note: perhaps that crate needs to be recompiled?
  = note: the following crate versions were found:
          crate `b`: /Users/runner/runners/2.164.7/work/1/s/target/cit/t750/foo/target/debug/deps/libb-98160c67a5811c37.rlib
          crate `b`: /Users/runner/runners/2.164.7/work/1/s/target/cit/t750/foo/target/debug/deps/libb-98160c67a5811c37.rmeta
          crate `a`: /Users/runner/runners/2.164.7/work/1/s/target/cit/t750/foo/target/debug/deps/liba-7d2b9ccd932a36e9.rmeta
```

There are two race-condition bugs here.

Race 1: The second cargo build command (`cargo build -pb`) would sometimes not build, because it thought `b` is fresh.  This can happen when the first build finishes and changing `b/src/lib.rs` happen within the same second. (#5918)  The test silently ignored this failure, this is not the cause of the CI failure, though.

Race 2: The first and second build commands work as expected.  The third build command fails because it thinks both `a` and `b` are "fresh".  However, `b` was just rebuilt, and `a` depends on it, so `a` should have been rebuilt.  It thinks `a` is fresh because `a`'s mtime is equal to `b` when `b` finishes compiling within the same second that the first build finished.

The solution here is to make sure the second step happens well after the first.  The underlying problem is #5918.
2020-02-05 04:16:45 +00:00
bors
06834dcaf2 Auto merge of #7855 - ehuss:fix-required-features-renamed, r=alexcrichton
Fix required-features using renamed dependencies.

The dep_name/feat_name syntax in required-features should use the "name in toml" for dep_name, not the actual package name.  Otherwise, it is impossible to actually enable the feature (because the `--features` flag expects a "name in toml").
2020-02-05 02:31:09 +00:00
Eric Huss
da8d17429f Fix rebuild_sub_package_then_while_package on HFS. 2020-02-04 17:42:09 -08:00
bors
acf88cc26a Auto merge of #7860 - ehuss:fix-std-collision, r=alexcrichton
Fix build-std collisions.

`build-std` unit filenames can collide with user dependencies in some situations.  In particular, `cc` as a build-dependency is likely to be exactly the same as a user's dep.  This would result in the `cc` crate being built twice, but with the same filename, causing a collision.

Other dependencies typically never collide because they have the `rustc-dep-of-std` feature, but build-dependencies do not.

The solution here is to include `is_std` in the metadata hash.

Fixes #7859.
2020-02-04 22:23:31 +00:00
Eric Huss
acfb89afc6 Remove likely brittle test.
This is too dependent on the particulars of libstd.
2020-02-04 14:22:29 -08:00
Kinrany
68a1c781d5 Merge branch 'master' into 7656-format-placeholder-code-when-generating-a-crate 2020-02-04 22:46:44 +03:00
Kinrany
a70ac57c59 Install rustfmt for testing in CI 2020-02-04 22:45:46 +03:00
Eric Huss
ebba7a3739 Fix build-std collisions. 2020-02-03 09:54:14 -08:00
Eric Huss
2296af27ae Fix BuildScriptOutput when a build script is run multiple times. 2020-02-02 13:26:22 -08:00
Eric Huss
cafec11467 Fix required-features using renamed dependencies.
The dep_name/feat_name syntax in required-features should use the
"name in toml" for dep_name, not the actual package name.
2020-02-02 09:59:15 -08:00
bors
972b9f55a7 Auto merge of #7837 - ehuss:fix-global-opt-alias, r=alexcrichton
Fix using global options before an alias.

Options before an alias were being ignored (like `cargo -v b`).  The solution is to extract those global options before expanding an alias, and then merging it later.

An alternative to this is to try to avoid discarding the options during expansion, but I couldn't figure out a way to get the position of the subcommand in the argument list.  Clap only provides a way to get the arguments *following* the subcommand.

I also cleaned up some of the code in `Config::configure`, which was carrying some weird baggage from previous refactorings.

Fixes #7834
2020-01-31 21:56:58 +00:00
Eric Huss
0279e8e63a Fix using global options before an alias. 2020-01-31 13:56:06 -08:00
bors
db11258193 Auto merge of #7851 - ehuss:version-bump, r=alexcrichton
Bump to 0.44.0, update changelog
2020-01-31 20:26:19 +00:00
Eric Huss
6efd25ca8b Update changelog for 1.42. 2020-01-31 12:07:08 -08:00
Eric Huss
f8fafbc3de Bump to 0.44.0. 2020-01-31 12:05:14 -08:00
bors
f9132126af Auto merge of #7823 - ehuss:stabilize-config-profile, r=alexcrichton
Stabilize config-profile.

This is a proposal to stabilize config-profiles. This feature was proposed in [RFC 2282](https://github.com/rust-lang/rfcs/pull/2282) and implemented in #5506. Tracking issue is rust-lang/rust#48683.

This is intended to land in 1.43 which will reach the stable channel on April 23rd.

This is a fairly straightforward extension of profiles where the exact same syntax from `Cargo.toml` can be specified in a config file. Environment variables are supported for everything except the `package` override table, where we do not support the ability to read arbitrary keys in the environment name.
2020-01-31 11:50:31 +00:00
Kinrany
1695b89b50 Merge branch 'master' into 7656-format-placeholder-code-when-generating-a-crate 2020-01-31 01:40:01 +03:00
Kinrany
768b60ab21 Log rustfmt output if it fails; also do not check that rustfmt exists
Worst case is that the logs will have multiple errors caused by missing
rustfmt, so checking separately that rustfmt exists is unnecessary.
2020-01-31 01:36:30 +03:00
bors
4fbd644bc7 Auto merge of #7844 - spastorino:fix-infinite-loop, r=alexcrichton
Swap std::sync::mpsc channel with crossbeam_channel

Hoping it closes #7840

r? @Mark-Simulacrum
2020-01-30 07:54:51 +00:00
bors
a07c26fb74 Auto merge of #7847 - rust-lang:dependabot/cargo/pretty_env_logger-0.4, r=alexcrichton
Update pretty_env_logger requirement from 0.3 to 0.4

Updates the requirements on [pretty_env_logger](https://github.com/seanmonstar/pretty-env-logger) to permit the latest version.
<details>
<summary>Commits</summary>
<ul>
<li><a href="fa4e28537f"><code>fa4e285</code></a> v0.4.0</li>
<li><a href="693b5e7088"><code>693b5e7</code></a> Remove chrono dependency</li>
<li><a href="28c5ad0cbb"><code>28c5ad0</code></a> env_logger: 0.6.2 -&gt; 0.7.0</li>
<li><a href="0288e4ed4b"><code>0288e4e</code></a> fixes env goof in README.md</li>
<li><a href="76d9fc7606"><code>76d9fc7</code></a> Make env_logger dependency public</li>
<li><a href="8ddffae2c5"><code>8ddffae</code></a> v0.3.1</li>
<li><a href="04c1aa50e1"><code>04c1aa5</code></a> require latest env_logger</li>
<li><a href="ce8c2f12fb"><code>ce8c2f1</code></a> fix deprecated calls</li>
<li><a href="67d2e7d68b"><code>67d2e7d</code></a> timestamps with milliseconds</li>
<li><a href="27eaa2bc1b"><code>27eaa2b</code></a> fix with_builder_1 example (<a href="https://github-redirect.dependabot.com/seanmonstar/pretty-env-logger/issues/25">#25</a>)</li>
<li>See full diff in <a href="https://github.com/seanmonstar/pretty-env-logger/compare/v0.3.0...v0.4.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>
2020-01-30 06:51:41 +00:00
dependabot-preview[bot]
0086332785
Update pretty_env_logger requirement from 0.3 to 0.4
Updates the requirements on [pretty_env_logger](https://github.com/seanmonstar/pretty-env-logger) to permit the latest version.
- [Release notes](https://github.com/seanmonstar/pretty-env-logger/releases)
- [Commits](https://github.com/seanmonstar/pretty-env-logger/compare/v0.3.0...v0.4.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-30 05:12:20 +00:00
Santiago Pastorino
20ddff8cb6
Swap std::sync::mpsc channel with crossbeam_channel
Switching this hoping it closes #7840
2020-01-28 12:35:11 -03:00
Kinrany
ea4f53cbd4 Fix tests on Linux/MacOS
The tests were failing with error:
"could not determine the current user, please set $USER"
2020-01-28 00:46:56 +03:00
bors
c326fcb37e Auto merge of #7810 - giraffate:support_out_dir_in_build_section, r=alexcrichton
Support out-dir in build section of Cargo configuration file

Fixed #7555.
2020-01-27 19:41:32 +00:00
bors
328b7d6b16 Auto merge of #7768 - chrisduerr:install-workspaces-from-git, r=ehuss
Search for root manifest with ephemeral workspaces

Fixes #5495.

This seems like it's too simple to just work like this, but after trying a few different things, this was the only solution which worked reliably for me.

I've verified that no `/target` is present in the actual checkout location, the target directory used is actually the one created in `/tmp`.

I've also verified that both workspaces and "normal" packages still install through git and that a normal `cargo install --path` works too (though that doesn't use ephemeral workspaces anyways).
2020-01-27 18:13:10 +00:00
Eric Huss
601d04c2ce Fix typo. 2020-01-27 10:12:22 -08:00
Kinrany
5ab0be0fd8 Merge branch 'master' into 7656-format-placeholder-code-when-generating-a-crate 2020-01-27 19:43:03 +03:00
Kinrany
6baf6bca01 Add tests
Test 1: init a library crate with a `rustfmt.toml` config file in it.
Expect the generated source files to be formatted according to the
config file.

Test 2: same as test 1, but with missing `rustfmt`. Expect `cargo init`
to ignore the absence of `rustfmt` and generate source files
with default formatting.
2020-01-27 19:42:20 +03:00
Kinrany
63cb62df4d Deduplicate warnings about missing rustfmt
There's now exactly one warning per new crate instead of one per
source file.

Also warnings are being logged now, not printed to console.
2020-01-26 23:56:44 +03:00
bors
9d32b7b014 Auto merge of #7836 - Mark-Simulacrum:clean-error, r=ehuss
Polish code to clarify meaning

This preserves the same behavior, but the previous code looked like it might
loop, but in fact never did.
0.43.0
2020-01-26 18:27:29 +00:00
Mark Rousskov
de6c78c21e Polish code to clarify meaning
This preserves the same behavior, but the previous code looked like it might
loop, but in fact never did.
2020-01-26 12:16:01 -05:00
bors
2a0f0c8f38 Auto merge of #7829 - Mark-Simulacrum:fix-progress-panics, r=ehuss
Store maximum queue length

Previously, the queue length was constantly decreasing as we built crates, which
meant that we were incorrectly displaying the progress bar. In debug builds,
this even led to panics (due to underflow on subtraction).

Not sure if we can add a test case for this. I have made the panic unconditional on release/debug though by explicitly checking that current is less than the maximum for the progress bar.

Fixes https://github.com/rust-lang/cargo/pull/7731#issuecomment-578358824.
2020-01-26 01:15:51 +00:00
Mark Rousskov
dc6d219d8f Store maximum queue length
Previously, the queue length was constantly decreasing as we built crates, which
meant that we were incorrectly displaying the progress bar. In debug builds,
this even led to panics (due to underflow on subtraction).
2020-01-25 14:22:27 -05:00
Kinrany
f8edf751d2 Merge branch 'master' into 7656-format-placeholder-code-when-generating-a-crate 2020-01-25 06:19:59 +03:00
kinrany
aa7fe99c33 Log entry 2: first implementation
I think I found the correct place in the algorithm where rustfmt should
be called.

I'm not sure if using `std::process::Command` and converting errors into
warnings is the correct way here.

Also the warning should only be printed once. Unless
`config.shell().warn()` deduplicates warnings, right now there will be
one warning per source file.

So I should probably check that `rustfmt` exists only once and disable
formatting if it doesn't.
2020-01-25 05:41:22 +03:00
Christian Duerr
8786dec1ba
Refactor code 2020-01-24 22:08:32 +01:00