Reduce exposure of three functions used only within `rustc_incremental`.

This commit is contained in:
Nicholas Nethercote 2023-10-24 16:34:03 +11:00
parent 72e8690c04
commit ca29c272e7
4 changed files with 3 additions and 9 deletions

View File

@ -20,13 +20,10 @@ mod persist;
use assert_dep_graph::assert_dep_graph; use assert_dep_graph::assert_dep_graph;
pub use persist::copy_cgu_workproduct_to_incr_comp_cache_dir; pub use persist::copy_cgu_workproduct_to_incr_comp_cache_dir;
pub use persist::delete_workproduct_files;
pub use persist::finalize_session_directory; pub use persist::finalize_session_directory;
pub use persist::garbage_collect_session_directories;
pub use persist::in_incr_comp_dir; pub use persist::in_incr_comp_dir;
pub use persist::in_incr_comp_dir_sess; pub use persist::in_incr_comp_dir_sess;
pub use persist::load_query_result_cache; pub use persist::load_query_result_cache;
pub use persist::prepare_session_directory;
pub use persist::save_dep_graph; pub use persist::save_dep_graph;
pub use persist::save_work_product_index; pub use persist::save_work_product_index;
pub use persist::setup_dep_graph; pub use persist::setup_dep_graph;

View File

@ -202,7 +202,7 @@ pub fn in_incr_comp_dir(incr_comp_session_dir: &Path, file_name: &str) -> PathBu
/// The garbage collection will take care of it. /// The garbage collection will take care of it.
/// ///
/// [`rustc_interface::queries::dep_graph`]: ../../rustc_interface/struct.Queries.html#structfield.dep_graph /// [`rustc_interface::queries::dep_graph`]: ../../rustc_interface/struct.Queries.html#structfield.dep_graph
pub fn prepare_session_directory( pub(crate) fn prepare_session_directory(
sess: &Session, sess: &Session,
crate_name: Symbol, crate_name: Symbol,
stable_crate_id: StableCrateId, stable_crate_id: StableCrateId,
@ -621,7 +621,7 @@ fn is_old_enough_to_be_collected(timestamp: SystemTime) -> bool {
} }
/// Runs garbage collection for the current session. /// Runs garbage collection for the current session.
pub fn garbage_collect_session_directories(sess: &Session) -> io::Result<()> { pub(crate) fn garbage_collect_session_directories(sess: &Session) -> io::Result<()> {
debug!("garbage_collect_session_directories() - begin"); debug!("garbage_collect_session_directories() - begin");
let session_directory = sess.incr_comp_session_dir(); let session_directory = sess.incr_comp_session_dir();

View File

@ -11,14 +11,11 @@ mod save;
mod work_product; mod work_product;
pub use fs::finalize_session_directory; pub use fs::finalize_session_directory;
pub use fs::garbage_collect_session_directories;
pub use fs::in_incr_comp_dir; pub use fs::in_incr_comp_dir;
pub use fs::in_incr_comp_dir_sess; pub use fs::in_incr_comp_dir_sess;
pub use fs::prepare_session_directory;
pub use load::load_query_result_cache; pub use load::load_query_result_cache;
pub use load::setup_dep_graph; pub use load::setup_dep_graph;
pub use load::LoadResult; pub use load::LoadResult;
pub use save::save_dep_graph; pub use save::save_dep_graph;
pub use save::save_work_product_index; pub use save::save_work_product_index;
pub use work_product::copy_cgu_workproduct_to_incr_comp_cache_dir; pub use work_product::copy_cgu_workproduct_to_incr_comp_cache_dir;
pub use work_product::delete_workproduct_files;

View File

@ -45,7 +45,7 @@ pub fn copy_cgu_workproduct_to_incr_comp_cache_dir(
} }
/// Removes files for a given work product. /// Removes files for a given work product.
pub fn delete_workproduct_files(sess: &Session, work_product: &WorkProduct) { pub(crate) fn delete_workproduct_files(sess: &Session, work_product: &WorkProduct) {
for (_, path) in work_product.saved_files.items().into_sorted_stable_ord() { for (_, path) in work_product.saved_files.items().into_sorted_stable_ord() {
let path = in_incr_comp_dir_sess(sess, path); let path = in_incr_comp_dir_sess(sess, path);
if let Err(err) = std_fs::remove_file(&path) { if let Err(err) = std_fs::remove_file(&path) {