This commit starts to lay the groundwork for rust-lang#6660 where Cargo will
invoke rustc in a "pipelined" fashion. The goal here is to execute one
command to produce both an `*.rmeta` file as well as an `*.rlib` file
for candidate compilations. In that case if another rlib depends on that
compilation, then it can start as soon as the `*.rmeta` is ready and not
have to wait for the `*.rlib` compilation.
The major refactoring in this commit is to add a new form of
`CompileMode`: `BuildRmeta`. This mode is introduced to represent that a
dependency edge only depends on the metadata of a compilation rather
than the the entire linked artifact. After this is introduced the next
major change is to actually hook this up into the dependency graph.
The approach taken by this commit is to have a postprocessing pass over
the dependency graph. After we build a map of all dependencies between
units a "pipelining" pass runs and actually introduces the `BuildRmeta`
mode. This also makes it trivial to disable/enable pipelining which
we'll probably want to do for a preview period at least! The
`pipeline_compilations` function is intended to be extensively
documented with the graph that it creates as well as how it works in
terms of adding `BuildRmeta` nodes into the dependency graph.
This commit is not all that will be required for pieplining
compilations. It does, however, get the entire test suite passing with
this refactoring. The way this works is by ensuring that a pipelined
unit, one split from `Build` into both `Build` and `BuildRmeta`, to be a
unit that doesn't actually do any work. That way the `BuildRmeta`
actually does all the work currently and we should have a working Cargo
like we did before. Subsequent commits will work in updating the
`JobQueue` to account for pipelining...
Note that this commit itself doesn't really contain any tests because
there's no functional change to Cargo, only internal refactorings. This
does have a large impact on the test suite because the `--emit` flag has
now changed by default, so lots of test assertions needed updating.