`Compiler::register_plugins()` calls `passes::register_plugins()`, which
calls `Compiler::dep_graph_future()`. This is the only way in which a
`passes` function calls a `Compiler` function.
This commit moves the `dep_graph_future()` call out of
`passes::register_plugins()` and into `Compiler::register_plugins()`,
which is a more sensible spot for it. This will delay the loading of the
dep graph slightly -- from the middle of plugin registration to the end
of plugin registration -- but plugin registration is fast enough
(especially compared to expansion) that the impact should be neglible.
}
pub fn register_plugins<'a>(
- compiler: &Compiler,
sess: &'a Session,
cstore: &'a CStore,
mut krate: ast::Crate,
});
}
- // If necessary, compute the dependency graph (in the background).
- compiler.dep_graph_future().ok();
-
time(sess, "recursion limit", || {
middle::recursion_limit::update_limits(sess, &krate);
});
let crate_name = self.crate_name()?.peek().clone();
let krate = self.parse()?.take();
- passes::register_plugins(
- self,
+ let result = passes::register_plugins(
self.session(),
self.cstore(),
krate,
&crate_name,
- )
+ );
+
+ // Compute the dependency graph (in the background). We want to do
+ // this as early as possible, to give the DepGraph maximum time to
+ // load before dep_graph() is called, but it also can't happen
+ // until after rustc_incremental::prepare_session_directory() is
+ // called, which happens within passes::register_plugins().
+ self.dep_graph_future().ok();
+
+ result
})
}