Expand description

Constructs the dependency graph for compilation.

Rust code is typically organized as a set of Cargo packages. The dependencies between the packages themselves are stored in the Resolve struct. However, we can’t use that information as is for compilation! A package typically contains several targets, or crates, and these targets has inter-dependencies. For example, you need to compile the lib target before the bin one, and you need to compile build.rs before either of those.

So, we need to lower the Resolve, which specifies dependencies between packages, to a graph of dependencies between their targets, and this is exactly what this module is doing! Well, almost exactly: another complication is that we might want to compile the same target several times (for example, with and without tests), so we actually build a dependency graph of Units, which capture these properties.

Functions