bors [Sun, 22 Dec 2019 17:35:34 +0000 (17:35 +0000)]
Auto merge of #7737 - Mark-Simulacrum:cache-not-mem, r=ehuss
Read cached output line-by-line
This avoids loading potentially gigabytes of output into memory, which
can cause OOMs.
Fixes #7736.
This does not add a test as I don't really want to generate gigabytes of output (that seems like a bad idea) -- and it's unclear how to test other than by causing OOM on (most) CI systems, and it's unlikely that we'll actually regress here.
bors [Sun, 22 Dec 2019 03:42:20 +0000 (03:42 +0000)]
Auto merge of #7733 - ehuss:doc-updates, r=Eh2406
Various doc updates
This is a collection of documentation updates that have been in my todo list for a while. Each change is in a separate commit.
The "features" chapter will probably get significant changes in the future, as it is pretty bare right now. Similarly the "workspace" chapter could probably use more examples.
bors [Thu, 19 Dec 2019 17:55:00 +0000 (17:55 +0000)]
Auto merge of #7649 - ehuss:config2, r=alexcrichton
Config enhancements.
This is a collection of changes to config handling. I intended to split this into separate PRs, but they all built on one another so I decided to do it as one. However, I can still split this up if desired.
High level overview:
- Refactorings, mainly to remove `pub` from `Config::get_table` and use serde API instead.
- Add `--config` CLI option.
- Add config `include` to include other files.
This makes some progress on #5416.
Closes #6699.
This makes a minor user-visible change in regards to `StringList` types. If an array is specified in a config as a list, and also as an env var, they will now be merged. Previously the environment variable overrode the file value. But if it is a string, then it won't join (env var takes precedence). I can probably change this, but I'm not sure if the old behavior is desired, or if it should merge all the time?
**Future plans**
This lays the groundwork for some more changes:
- Work on #7253 (`debug-assertions` and `debug` fails in environment vars). I have some ideas to try.
- Consider removing use of `get_list` for `paths`, and use a `Vec<ConfigRelativePath>`. This will require some non-trivial changes to how `ConfigSeqAccess` works. This is one of the last parts that does not use the serde API.
- Possibly change `[source]` to load config values in a lazy fashion. This will unlock the ability to use environment variables with source definitions (like CARGO_SOURCE_CRATES_IO_REPLACE_WITH).
- Possibly change `[profile]` to load config profiles in a lazy fashion. This will make it easier to use environment variables with profiles, particularly with arbitrarily named profiles.
- Possibly remove the case-sensitive environment variables in `-Zadvanced-env`. I think they are just too awkward, and prone to problems. Instead, drive people towards using `--config` instead of env vars.
- Add support for TOML tables in env vars (like `CARGO_PROFILES={my-profile={opt-level=1}})`). I started implementing it, but then looking at the use cases, it didn't seem as useful as I initially thought. However, it's still an option to try.
**Refactoring overview**
- `[source]` table now uses the serde API.
- `[target]` table now uses the serde API. This is complicated since the 'cfg()' entries are different from the triple entries. The 'cfg()' tables are loaded separately, and are accessed from `Config::target_cfgs`. Otherwise, it just uses `config.get` of the specific target.TRIPLE.
- Moved the target config stuff into `config/target.rs`.
- Various changes to make this work:
- Added `PathAndArgs` type which replaces `config.get_path_and_args`.
- Changed `ConfigKey` to track the key parts as a list (instead of a string). This fixes an issue where quoted keys weren't handled properly (like `[foo.'a.b'.bar]`). This also seems to make a little more sense (it was joining parts into a string only to immediately call `split` on it). Changed various APIs to take a `ConfigKey` object instead of a string to avoid that splitting behavior.
- `ValueDeserializer` now pre-computes the `Definition` so that it can provide a better error message when a value fails to deserialize.
Overall, there shouldn't be significant user-visible changes. Some error messages have changed and warnings have been added for some ignored keys. `-Zadvanced-env` now works for source and target tables, though I'm not really happy with that feature.
The duplication of the URLs is a little unfortunate. It could use the name of the registry, but that is not readily available and is tricky to obtain. I feel like that is a challenge for another day.
bors [Mon, 16 Dec 2019 16:29:59 +0000 (16:29 +0000)]
Auto merge of #7700 - ehuss:proc-macro-extern-prelude, r=alexcrichton
Add proc_macro to the extern prelude.
This makes it so that a proc-macro library can use the `proc_macro` crate without the `extern crate proc_macro;` item on the 2018 edition. This is the Cargo half of https://github.com/rust-lang/rust/pull/64882.
bors [Mon, 16 Dec 2019 15:29:53 +0000 (15:29 +0000)]
Auto merge of #7631 - jsgf:explicit-version, r=alexcrichton
vendor: implement --versioned-dirs
Implement `--explicit-version` from standalone cargo-vendor. This helps with vendoring
performance as it avoids redundantly deleting and re-copying already vendored packages.
For example, re-vendoring cargo's dependencies it makes a big difference in wallclock
time. For initial vendoring it makes no difference, but re-vendoring (ie, when most or all dependencies haven't changed) without explicit versions is actually slightly slower
(5.8s -> 6s), but with explicit versions it goes from 5.8s -> 1.6s.
Timings:
Without explicit versions, initial vendor
real 0m5.810s
user 0m0.924s
sys 0m2.491s
Re-vendor:
real 0m6.083s
user 0m0.937s
sys 0m2.654s
With explicit versions, initial vendor:
real 0m5.810s
user 0m0.937s
sys 0m2.461s
Re-vendor:
real 0m1.567s
user 0m0.578s
sys 0m0.967s
bors [Thu, 12 Dec 2019 19:03:51 +0000 (19:03 +0000)]
Auto merge of #7698 - dtolnay:description, r=alexcrichton
Remove use of deprecated Error::description method
We are getting ready to deprecate std::error::Error::description: rust-lang/rust#66919. This PR replaces one place that should be using Display instead.
bors [Thu, 12 Dec 2019 18:39:29 +0000 (18:39 +0000)]
Auto merge of #7695 - giraffate:add_and_update_tests_for_jobs_of_cargo_build, r=ehuss
Add and move tests for jobs of `cargo build`
A test when argument is negative is added. In addition, `default_cargo_config_jobs` and `good_cargo_config_jobs` is moved from `testsuite/bad_config.rs` to `testsuite/build.rs` because these tests are not for `bad config`.
bors [Thu, 12 Dec 2019 18:19:57 +0000 (18:19 +0000)]
Auto merge of #7680 - stefanhoelzl:issue-7183, r=ehuss
include dotfiles in packages
This PR solves #7183
It changes the behavior of `cargo package` to also include dotfiles by default.
It should be discussed if this is intended or if the implementation should be changed to only include dotfiles which are specified in the `include` section.
From the [existing comment](https://github.com/stefanhoelzl/cargo/blob/40885dfab40a1bf62b22aa03f732ef45163c013f/src/cargo/sources/path.rs#L358) it is a little bit unclear to me, but I supposed it was intended only to exclude directories starting with a dot?
bors [Thu, 12 Dec 2019 17:59:45 +0000 (17:59 +0000)]
Auto merge of #7699 - ehuss:build-std-no-sysroot, r=alexcrichton
Switch build-std to use --extern
Switch `build-std` to use `--extern` flags instead of `--sysroot`.
This is mostly a revert of #7421. It uses the new extern flag options introduced in https://github.com/rust-lang/rust/pull/67074. It avoids modifying the extern prelude which was the source of the problem of https://github.com/rust-lang/wg-cargo-std-aware/issues/40.
bors [Wed, 11 Dec 2019 17:51:57 +0000 (17:51 +0000)]
Auto merge of #7694 - danielparks:issue-7691-manifest-badges-section, r=ehuss
Clarify manifest format docs for [badges] section
Previously the `[badges]` section documentation was mixed in with the `[package]` section. This extracts it out under its own heading.
This also pulls the `license` and `license-file` field documentation out of the package metadata code block. It sets the example license to “MIT OR Apache-2.0” since that is the typical licensing scheme for many crates.
This includes minor rewrites for clarity and to match the register of the rest of the document.
Takayuki Nakata [Wed, 11 Dec 2019 09:01:01 +0000 (18:01 +0900)]
Add and move tests for jobs of `cargo build`
A test when argument is negative is added. In addition,
`default_cargo_config_jobs` and `good_cargo_config_jobs` is moved from
`testsuite/bad_config.rs` to `testsuite/build.rs` because these tests
are not for `bad config`.
Daniel Parks [Tue, 10 Dec 2019 23:20:01 +0000 (15:20 -0800)]
Clarify manifest format docs for [badges] section
Previously the `[badges]` section documentation was mixed in with the
`[package]` section. This extracts it out under its own heading.
This also pulls the `license` and `license-file` field documentation out
of the package metadata code block. It sets the example license to “MIT
OR Apache-2.0” since that is the typical licensing scheme for many
crates.
This includes minor rewrites for clarity and to match the register of
the rest of the document.
bors [Mon, 9 Dec 2019 16:16:56 +0000 (16:16 +0000)]
Auto merge of #7687 - giraffate:Update_the_layout_of_cargo_commands, r=ehuss
Update the layout of `Cargo Commands` in doc
It seems better to improve the follwing two points.
- A subcategory like [`Build Commands`](https://doc.rust-lang.org/stable/cargo/commands/build-commands.html) does not contain any contents.
- [`Cargo Commands`](https://doc.rust-lang.org/stable/cargo/commands/index.html) actually just points to `cargo` command.
So, I fix categories like `Build Commands` to include links to each
commands. In addition, I add `cargo` command to `General Commands`.
I just changed the way it was arranged and nothing about the contents.
The following is an example.
before
<img width="1283" alt="スクリーンショット 2019-12-09 10 01 44" src="https://user-images.githubusercontent.com/17407489/70399888-f2c3df80-1a6a-11ea-813b-4bba47d3b659.png">
after
<img width="1415" alt="スクリーンショット 2019-12-09 10 06 43" src="https://user-images.githubusercontent.com/17407489/70400018-a4631080-1a6b-11ea-8bd4-ab15338ae508.png">
Takayuki Nakata [Mon, 9 Dec 2019 00:47:50 +0000 (09:47 +0900)]
Update the layout of `Cargo Commands` in doc
It seems better to improve the follwing two points.
- A subcategory like `Build Commands` does not contain any contents.
- `Cargo Commands` actually just points to `cargo` command.
So, I fix categories like `Build Commands` to include links to each
commands. In addition, I add `cargo` command to `General Commands`.