9066 Commits

Author SHA1 Message Date
Eric Huss
0a2f691381 Switch azure to macOS 10.15. 2020-02-19 16:46:29 -08:00
bors
e0678fbbf8 Auto merge of #7901 - ehuss:config-cli-path, r=alexcrichton
Support `--config path_to_config.toml` cli syntax.

Updates the `--config` flag so that if the argument appears to be a file, it will load the file.

cc #7722, #7723
2020-02-18 20:08:05 +00:00
Eric Huss
1d5d7a269f Support --config path_to_config.toml cli syntax. 2020-02-18 09:30:27 -08:00
bors
e02974078a Auto merge of #7697 - ehuss:bin-test-env, r=alexcrichton
Set an environment variable for tests to find executables.

This adds the environment variable `CARGO_BIN_EXE_<name>` so that integration tests can find binaries to execute, instead of doing things like inspecting `env::current_exe()`.

The use of uppercase is primarily motivated by Windows whose Rust implementation behaves in a strange way.  It always ascii-upper-cases keys to implement case-insensitive matching (which loses the original case).  Seems less likely to result in confusion?

Closes #5758.
2020-02-18 15:24:43 +00:00
bors
74f2b400d2 Auto merge of #7896 - ehuss:internal-errors, r=alexcrichton
Rework internal errors.

This changes the behavior of "internal" errors, which were previously hidden and only displayed with `--verbose`. The changes here:

- `internal` now means "a cargo bug", and is always displayed and requests that the user file a bug report.
- Added `VerboseError` to signify an error that should only be displayed with `--verbose`. This is only used in one place, to display the `rustc` compiler command if the compiler exited with a normal error code (i.e. not a crash).
- Audited the uses of internal errors, and promoted some to normal errors, as they seemed to contain useful information, but weren't necessarily bugs in cargo.
- Added some details to some errors.
- Sometimes the "run with --verbose" message wasn't being printed when I think it should. This happened when rustc failed while other rustc processes were running. Another case was with `cargo install` installing multiple packages, and one of them fails.
2020-02-18 14:42:57 +00:00
Eric Huss
0d44a8267b Rework internal errors. 2020-02-17 19:03:57 -08:00
bors
914e31d7b2 Auto merge of #7891 - ehuss:stringlist-fixes, r=Eh2406
Improvements to StringList config handling.

`StringList` was using an untagged enum to deserialize a string or list.  Unfortunately, serde does not handle untagged enums very well.  The error messages are not very good, and it doesn't interact with untyped deserializers (like our environment variables).  This switches it to a newtype struct, and then has hard-coded support for it in the deserializer.  This fixes some deserialization errors (like treating `true` as a boolean) and provides better error messages.

`StringList` is currently used for `build.rustflags`, `target.*.rustflags`, and `target.*.runner`.

Fixes #7780
Fixes #7781
2020-02-17 00:08:14 +00:00
Eric Huss
fd258634c9 Improvements to StringList config handling. 2020-02-16 15:29:59 -08:00
bors
5f07972103 Auto merge of #7890 - ehuss:fingerprint-log-rustflags, r=Eh2406
Add new/old rustflags to fingerprint log.

Follow up to #7888. Due to a conversation with someone I had with Discord who was having trouble determining why something was rebuilding.
2020-02-16 20:10:00 +00:00
bors
1fa0f1b98f Auto merge of #7889 - ehuss:fix-env_args-doc, r=Eh2406
Fix inaccurate doc comment on `env_args`.
2020-02-16 19:50:13 +00:00
Eric Huss
25275b07bb Add new/old rustflags to fingerprint log. 2020-02-16 09:29:25 -08:00
Eric Huss
75fa342d59 Fix inaccurate doc comment on env_args. 2020-02-16 09:00:26 -08:00
bors
1492e5723e Auto merge of #7888 - ehuss:fingerprint-debug, r=Eh2406
Add some extra fingerprint debug information.

There have been some situations where the existing log info was not sufficient to understand the cause of a rebuild.  I hope that this additional information can help with debugging problems.
2020-02-16 14:08:20 +00:00
Eric Huss
677b24adad Add some extra fingerprint debug information. 2020-02-15 18:59:41 -08:00
bors
17855e583f Auto merge of #7886 - cuviper:cargo-platform-licenses, r=ehuss
Link the licenses into crates/cargo-platform

The licenses should be included in the package published on crates.io
2020-02-15 16:37:02 +00:00
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
Eric Huss
4cf531f5a6 Add more docs on CARGO_BIN_EXE_. 2020-02-06 22:03:59 -08: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
Eric Huss
499f917c03 Switch to case-sensitive environment variable. 2020-02-06 08:30:09 -08:00
Eric Huss
3489428921 Set an environment variable for tests to find executables. 2020-02-06 08:15:08 -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