Fix debug message.
The [path] field of [Fingerprint] contains the "Hash of the path to the base source file".
repro:
```
$ cargo new a
$ cd a
$ echo 'cfg-if="0"' >> Cargo.toml
$ CARGO_HOME=cargo1 cargo build
$ mv cargo1 cargo2
$ CARGO_LOG=cargo::core::compiler::fingerprint=trace CARGO_HOME=cargo2 cargo build
[...]
[... INFO cargo::core::compiler::fingerprint] err: path to the compiler has changed
```
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.
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.
Closes#3062Closes#3817Closes#3971Closes#4212Closes#4438Closes#4756Closes#5822Closes#6913Closes#7055
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.