In the current setup, we create the DepGraph very early, so it can be put into the CrateStore and the Session object. This means that we construct the DepGraph long before we have enough information to know where to load the previous DepGraph from and, because the CrateStore is used very early too, we are registering dep-nodes and edges before the graph is fully operational. This is ugly but harmless in the current implementation. In the new tracking system it would become a problem.
So the plan is to construct the DepGraph only when we can already load the previous DepGraph. This needs some refactoring:
Any work in this direction will want to be based on top of #44341 the master branch.
In the current setup, we create the
DepGraphvery early, so it can be put into theCrateStoreand theSessionobject. This means that we construct theDepGraphlong before we have enough information to know where to load the previousDepGraphfrom and, because theCrateStoreis used very early too, we are registering dep-nodes and edges before the graph is fully operational. This is ugly but harmless in the current implementation. In the new tracking system it would become a problem.So the plan is to construct the
DepGraphonly when we can already load the previousDepGraph. This needs some refactoring:dep_graphfield fromSession, - rustc: RemoveSession::dep_graph#44502dep_graphfield fromCStoreand don't do any dependency tracking in the regularCStoreimplementation. - rustc: RemoveDepGraphhandling from rustc_metadata #44418CrateStoreprivate toTyCtxt#44420CrateStorewrapper that does dependency tracking and make only that available viatcx.cstore(), and - Migrate a slew of metadata methods to queries #44142CrateStoreaccess go through queries. - Migrate a slew of metadata methods to queries #44142librustc_incremental::persist::fs::prepare_session_directory()to not need thetcxand invoke it right after parsing, when we know the definitive crate name. - rustc: RemoveSession::dep_graph#44502DepGraphconstruction to right afterlibrustc_incremental::persist::fs::prepare_session_directory()has been called. - rustc: RemoveSession::dep_graph#44502Any work in this direction will want to be based on top of
#44341the master branch.