incr.comp.: Load dep-graph in the background (original) (raw)
The dependency graph is loaded at the earliest point possibly during the compilation session (after the crate disambiguator has been set):
| let dep_graph = if sess.opts.build_dep_graph() { |
|---|
However, it is only needed for the first time a few passes later:
| let hir_crate = lower_crate(sess, cstore, &dep_graph, &krate, &mut resolver); |
|---|
This was intentional so that we have to possibility to load and decode it the graph on a background thread. One way to implement this is to make rustc_incremental::load_dep_graph() start a new thread and return the thread::JoinHandle and then only join that thread right before the dep-graph is actually needed.