Commit graph

8607 commits

Author SHA1 Message Date
Eric Huss 384c311692 rustfmt for nightly changes. 2019-10-18 14:20:01 -07:00
bors 3a9abe3f06 Auto merge of #7512 - Xyene:patch-1, r=alexcrichton
Fix typo in git index initialization error path

This PR proposes a fix for a small typo I ran into while using `cargo`.
2019-10-15 15:55:35 +00:00
bors c25db6c875 Auto merge of #7507 - ehuss:virtual-ws-features, r=alexcrichton
Reject feature flags in a virtual workspace.

This generates an error if feature flags are used in the root of a virtual workspace. Previously these flags were completely ignored.  In the interest of avoiding confusion, I think it would be good to be explicit that these don't currently work.  This could alternatively be a warning, but I think it is better to reject it outright.

cc #4753, #3620, #5015, #6195, etc.
2019-10-15 15:26:07 +00:00
bors 1e764dbd4d Auto merge of #7504 - ehuss:rename-package-overrides, r=alexcrichton
Rename `overrides` to `package` in profiles.

Renaming per the discussion at https://github.com/rust-lang/rust/issues/48683#issuecomment-488842694.

I left backwards-compatibility in case anyone is using it, since it required very little effort.

cc @da-x, FYI.
2019-10-15 15:01:26 +00:00
bors 78ba63019d Auto merge of #7333 - ehuss:allow-dev-dep-path, r=alexcrichton
Allow publishing with dev-dependencies without a version.

This change allows dev-dependencies without a `version` key to be published.  If a dev-dependency is missing the `version`, it will be stripped from the packaged manifest.
2019-10-15 14:38:29 +00:00
bors b03182a8ff Auto merge of #7450 - ehuss:stabilize-cache-messages, r=alexcrichton
Stabilize cache-messages

This stabilizes the -Zcache-messages feature, making it always enabled.

## What is stabilized?

This feature is intended to redisplay previous warnings on a "fresh" build instead of displaying no output.

Users have occasionally indicated frustration when they know there are warnings, but no output is displayed when the build is fresh. This also improves the interaction between `cargo check` and `cargo clippy-preview`. This also simplifies the code, and opens more possibilities for `rustc` to send side-channel messages to Cargo.

Cargo will now use JSON output from `rustc` and `rustdoc` 100% of the time (`rustdoc --test` does not use JSON). Previously Cargo would only use JSON for pipelined crates.

Cargo will save the JSON output into a file named `output` in the `.fingerprint` directory. This file is only created when the compiler outputs a diagnostic message.

If a crate is being recompiled, and Cargo considers it to be "fresh", it will replay the output file to the console.

## Notable changes in this PR

- Fixed a bug where replays were erroneously including pipeline rmeta artifact json messages.
- clippy-preview is now included in the metadata hash, to force its artifacts to be separate from `cargo check`.
- clippy-preview is no longer force-enabled, under the assumption that caching and fingerprinting is accurate, and the cached messages will be replayed.
- clippy-preview's arguments are included in the fingerprint now that it is not force-enabled.
- Rustdoc colors and short messages were fixed when pipelining was stabilized, so updated tests.

Closes #6986
Closes #6848
Closes #6664
Closes #2458

## Concerns

The only notable issue with this is that switching between short and long human messages only replays the format from the first invocation.  That is, if you do `cargo build` and it generates warnings, then running again with `--message-format=short` will still show the full length human messages. I'm personally fine with that behavior, even though it is not ideal. I think this feature overall improves the situation (where before *no* output was displayed). Being able to re-render between short/long is a very difficult problem, and unlikely to be fixable in the foreseeable future.

There was some concern expressed about being able to disable this. I think that would only be necessary if a severe bug is discovered. I do not feel that this change is risky enough to warrant a configurable option. If it does cause a problem, it can be quickly reverted with a one-line change to set `OutputOptions::cache_cell` to `None`. Since pipelining has been using JSON output for a while now without complaints, I feel pretty confident in it.
2019-10-15 13:48:13 +00:00
Tudor Brindus aaf8167bb1
Fix typo in git index initialization error path 2019-10-14 22:46:02 -04:00
Eric Huss bf474ba589 Reject feature flags in a virtual workspace. 2019-10-14 12:40:14 -07:00
Eric Huss fcfe0b8988 Rename overrides to package in profiles. 2019-10-10 14:39:30 -07:00
bors d5d7557cf5 Auto merge of #7502 - matthiaskrgr:dont_lock_target_dir_7490, r=ehuss
don't lock the package cache when cleaning target dir.

Fixes #7490
2019-10-10 21:34:35 +00:00
Matthias Krüger 9883d20a52 don't lock the package cache when cleaning target dir.
Fixes #7490
2019-10-10 21:48:04 +02:00
bors aa4820bb87 Auto merge of #7499 - orium:document-rustc-wrapper, r=Eh2406
Document rustc wrapper
2019-10-10 15:37:37 +00:00
Diogo Sousa 674241b2d0 Document the rustc-wrapper configuration. 2019-10-09 23:44:57 +01:00
Diogo Sousa 97d9608bed Config::get_tool() now also accepts the configuration path in idiomatic kebab-case. 2019-10-09 23:44:52 +01:00
bors 94bf4781d0 Auto merge of #7456 - alexcrichton:config-only-serde, r=ehuss
Migrate towards exclusively using serde for `Config`

This series of commits was spawned off a thought I had while reading https://github.com/rust-lang/cargo/issues/7253#issuecomment-535656059, although it ended up not really touching on that at all. I was a little unsettled about how unstructured the config accesses are throughout Cargo and we had sort of two systems (one serde which is nice, one which is more manual) for reading config values.

This PR converts everything to run through serde for deserializing values, except for `get_list` which is funky. There's only one usage of that with the `paths` key though and we can probably fix this soon-ish.

In any case, the highlights of this PR are:

* This PR is surprisingly large. I did a lot of movement in `config.rs` to try to make the file smaller and more understandable.
* The `Value` type which retains information about where it was deserialized from is very special, and has special treatment with serde's data model. That's what allows us to use that and serde at the same time.
* The `ConfigRelativePath` and `ConfigKey` structures have been revamped internally, but morally serve the same purposes as before.
* Cargo now has structured `struct` access for a bunch of its configuration (`net`, `http`, `build`, etc). I would ideally like to move toward a world where this is the *only* way to read configuration, or at least everything conventionally runs through those paths.
* Functionally, this PR should have no difference other than tweaks to error messages here and there, and perhaps more strict validation on commands where we validate more configuration on each run than we previously did.
* This isn't a 100% transition for Cargo yet, but I figured it would be a good idea to post this and get some feedback first.
* In the long run I want to remove `get_env`, `get_cv`, and `get_*_priv` from `Config` as internal details. I'd like to move this all to `de.rs` and have it walk down the tree of configuration as we deserialize a value. For now though these all remain in place and that refactoring is left to a future PR.
2019-10-09 16:55:15 +00:00
Alex Crichton 9a12e48c8d More review comments 2019-10-09 09:54:57 -07:00
bors 515a6df4fc Auto merge of #7492 - ehuss:enable-msvc-tests, r=alexcrichton
Re-enable some MSVC tests.

These tests were disabled for MSVC in #7400, but I would prefer to keep them running.
2019-10-08 22:12:48 +00:00
bors 9005002630 Auto merge of #7489 - da-x:fix-7488, r=ehuss
when -Z unstable-options not specified, don't validate --profile

This fixes a regression caused by 8b0561d68f - Closes #7488.
2019-10-08 19:53:13 +00:00
Eric Huss 5ccabc829e Re-enable some MSVC tests. 2019-10-08 10:13:24 -07:00
Dan Aloni 9dc70a3dab Rustfmt lint 2019-10-08 11:07:19 +03:00
Dan Aloni e04099e6a3 tests: cover issue #7488 2019-10-08 09:49:25 +03:00
bors a7c939c62f Auto merge of #7470 - alexcrichton:cyclic-error, r=Eh2406
Improve error message for cyclic dependencies

First reported in rust-lang/rust#65014 it looks like our error message
on cyclic dependencies may be confusing at times. It looks like this is
an issue because there are multiple paths through a graph for a
dependency, so using the generic `path_to_top` function isn't producing
the most useful path for this purpose.

We're already walking the graph though, so this commit adds an extra
parameter which collects the list of packages we've visited so far to
produce a hopefully always-accurate error message showing the chain of
dependencies end-to-end for what depends on what.
2019-10-08 01:16:07 +00:00
Alex Crichton e0667f5831 Add comments of Value<T>'s deserialization protocol 2019-10-07 17:12:03 -07:00
Alex Crichton 2387e1a867 Document the new ConfigKey implementation 2019-10-07 17:12:03 -07:00
Alex Crichton 0a9a46eb24 Remove unnecessary clone 2019-10-07 17:12:03 -07:00
Alex Crichton a0d94ffd02 Add documentation for StringList 2019-10-07 17:12:03 -07:00
Alex Crichton dab42bbbc7 Use #[serde(rename_all)] instead of listing them all 2019-10-07 17:12:03 -07:00
Alex Crichton 3a6cd74434 Run rustfmt 2019-10-07 17:12:03 -07:00
Alex Crichton fe7b5fc6de Handle rebase conflicts 2019-10-07 17:12:03 -07:00
Alex Crichton 44a31d676d Simplify cargo-new configuration reading
No need for lots of extra helpers/parsing when using serde!
2019-10-07 17:12:03 -07:00
Alex Crichton d7d8ca1e12 Consolidate build key configuration
Add a typed structure which lists all `build` key configuration
throughout Cargo.
2019-10-07 17:12:03 -07:00
Alex Crichton 09d9165d27 Remove dead Config::get_i64 method 2019-10-07 17:12:03 -07:00
Alex Crichton a458cd82e2 Remove no-longer-needed Config::get_bool 2019-10-07 17:12:03 -07:00
Alex Crichton 8d659063e5 Consolidate net configuration into a typed structure
Less need for `get_bool` and friends!
2019-10-07 17:12:03 -07:00
Alex Crichton cbda5322a0 Access term config through a deserialized type
Going through and removing users of raw `get_*` functions!
2019-10-07 17:12:03 -07:00
Alex Crichton 2357bb041f Centralize HTTP configuration in one struct
Gives us one nice place to access and document all HTTP-related configuration
2019-10-07 17:12:03 -07:00
Alex Crichton 5bba42615a Remove a usage of get_list
This callsite doesn't need the full power of `get_list`, knowing the
definition path of each element along the list.
2019-10-07 17:12:03 -07:00
Alex Crichton 37ace8886a Finish implementing Value, use it in helpers
Rewrite helpers like `get_bool` to use `get::<Option<Value<bool>>>`
instead of duplicating the logic that's already with the typed access of
configuration. This is more along the effort to centralize all
deserialization of configuration into typed values instead of using
ad-hoc accessors in a number of locations.
2019-10-07 17:12:03 -07:00
Alex Crichton c0baf844e3 Refactor ConfigKey to its own file
Also make it a little less allocation-heavy by tweaking the API to
encourage incremental building of the key and incremental destruction as
we walk throughout the configuration tree.
2019-10-07 17:12:03 -07:00
Alex Crichton 0f73320ee7 Extra serde config support to a separate file 2019-10-07 17:12:03 -07:00
Alex Crichton 022814d268 Move config.rs to config/mod.rs 2019-10-07 17:12:03 -07:00
Alex Crichton a92fd48fb4 Improve error message for cyclic dependencies
First reported in rust-lang/rust#65014 it looks like our error message
on cyclic dependencies may be confusing at times. It looks like this is
an issue because there are multiple paths through a graph for a
dependency, so using the generic `path_to_top` function isn't producing
the most useful path for this purpose.

We're already walking the graph though, so this commit adds an extra
parameter which collects the list of packages we've visited so far to
produce a hopefully always-accurate error message showing the chain of
dependencies end-to-end for what depends on what.
2019-10-07 16:50:42 -07:00
bors c77f31ca80 Auto merge of #7484 - ehuss:clippy-fixes, r=alexcrichton
Some minor clippy fixes.
2019-10-07 23:29:59 +00:00
Dan Aloni 1e57d7a523 named-profiles: when -Z unstable-options not specified, don't validate --profile
Fixes #7488.
2019-10-07 23:11:14 +03:00
Eric Huss fba07ba1fc Some minor clippy fixes. 2019-10-04 14:21:28 -07:00
bors a429e8cc46 Auto merge of #7481 - Lythenas:doc-spdx-list-3.6, r=ehuss
Update SPDX list to 3.6

Fixes #7477
2019-10-04 17:36:12 +00:00
bors 6925462a3e Auto merge of #7482 - alexcrichton:fix-bin, r=ehuss
Fix wrong directories in PATH on Windows

This fixes an accidental regression from #7425 where `PATH` was being
augmented on Windows with the wrong search path for target/host
libraries. This commit fixes the issue by simply always calculating the
host/target library paths for `TargetInfo`, and then we explicitly use
the same `TargetInfo` for filling out information in `Compilation`.

Closes #7475
2019-10-04 17:07:14 +00:00
Alex Crichton 61188d791a Fix wrong directories in PATH on Windows
This fixes an accidental regression from #7425 where `PATH` was being
augmented on Windows with the wrong search path for target/host
libraries. This commit fixes the issue by simply always calculating the
host/target library paths for `TargetInfo`, and then we explicitly use
the same `TargetInfo` for filling out information in `Compilation`.

Closes #7475
2019-10-04 08:06:17 -07:00
bors 0fe1638e80 Auto merge of #7476 - tlively:emscripten-wasm-aux, r=alexcrichton
Mark Emscripten's .wasm files auxiliary

This fixes #7471 and fixes #7255 by preventing the .wasm file from
being treated as an executable binary, so `cargo test` and `cargo run`
will no longer try to execute it directly. This change is only made
for Emscripten, which outputs a .js file as the primary executable
entry point, as opposed to other WebAssembly targets for which the
.wasm file is the only output.
2019-10-04 14:50:53 +00:00
Matthias Seiffert bfc360354d Update SPDX list to 3.6 2019-10-04 15:59:40 +02:00