rustc_incremental::persist::fs

Function prepare_session_directory

source
pub(crate) fn prepare_session_directory(
    sess: &Session,
) -> Result<(), ErrorGuaranteed>
Expand description

Allocates the private session directory.

If the result of this function is Ok, we have a valid incremental compilation session directory. A valid session directory is one that contains a locked lock file. It may or may not contain a dep-graph and work products from a previous session.

This always attempts to load a dep-graph from the directory. If loading fails for some reason, we fallback to a disabled DepGraph. See rustc_interface::queries::dep_graph.

If this function returns an error, it may leave behind an invalid session directory. The garbage collection will take care of it.