|
53 | 53 | //! ## Synchronization |
54 | 54 | //! |
55 | 55 | //! There is some synchronization needed in order for the compiler to be able to |
56 | | -//! determine whether a given private session directory is not in used any more. |
| 56 | +//! determine whether a given private session directory is not in use any more. |
57 | 57 | //! This is done by creating a lock file for each session directory and |
58 | 58 | //! locking it while the directory is still being used. Since file locks have |
59 | 59 | //! operating system support, we can rely on the lock being released if the |
@@ -136,26 +136,29 @@ const QUERY_CACHE_FILENAME: &str = "query-cache.bin"; |
136 | 136 | const INT_ENCODE_BASE: usize = base_n::CASE_INSENSITIVE; |
137 | 137 |
|
138 | 138 | /// Returns the path to a session's dependency graph. |
139 | | -pub fn dep_graph_path(sess: &Session) -> PathBuf { |
| 139 | +pub(crate) fn dep_graph_path(sess: &Session) -> PathBuf { |
140 | 140 | in_incr_comp_dir_sess(sess, DEP_GRAPH_FILENAME) |
141 | 141 | } |
| 142 | + |
142 | 143 | /// Returns the path to a session's staging dependency graph. |
143 | 144 | /// |
144 | 145 | /// On the difference between dep-graph and staging dep-graph, |
145 | 146 | /// see `build_dep_graph`. |
146 | | -pub fn staging_dep_graph_path(sess: &Session) -> PathBuf { |
| 147 | +pub(crate) fn staging_dep_graph_path(sess: &Session) -> PathBuf { |
147 | 148 | in_incr_comp_dir_sess(sess, STAGING_DEP_GRAPH_FILENAME) |
148 | 149 | } |
149 | | -pub fn work_products_path(sess: &Session) -> PathBuf { |
| 150 | + |
| 151 | +pub(crate) fn work_products_path(sess: &Session) -> PathBuf { |
150 | 152 | in_incr_comp_dir_sess(sess, WORK_PRODUCTS_FILENAME) |
151 | 153 | } |
| 154 | + |
152 | 155 | /// Returns the path to a session's query cache. |
153 | 156 | pub fn query_cache_path(sess: &Session) -> PathBuf { |
154 | 157 | in_incr_comp_dir_sess(sess, QUERY_CACHE_FILENAME) |
155 | 158 | } |
156 | 159 |
|
157 | 160 | /// Locks a given session directory. |
158 | | -pub fn lock_file_path(session_dir: &Path) -> PathBuf { |
| 161 | +fn lock_file_path(session_dir: &Path) -> PathBuf { |
159 | 162 | let crate_dir = session_dir.parent().unwrap(); |
160 | 163 |
|
161 | 164 | let directory_name = session_dir.file_name().unwrap().to_string_lossy(); |
@@ -202,7 +205,7 @@ pub fn in_incr_comp_dir(incr_comp_session_dir: &Path, file_name: &str) -> PathBu |
202 | 205 | /// The garbage collection will take care of it. |
203 | 206 | /// |
204 | 207 | /// [`rustc_interface::queries::dep_graph`]: ../../rustc_interface/struct.Queries.html#structfield.dep_graph |
205 | | -pub fn prepare_session_directory( |
| 208 | +pub(crate) fn prepare_session_directory( |
206 | 209 | sess: &Session, |
207 | 210 | crate_name: Symbol, |
208 | 211 | stable_crate_id: StableCrateId, |
@@ -373,7 +376,7 @@ pub fn finalize_session_directory(sess: &Session, svh: Option<Svh>) { |
373 | 376 | let _ = garbage_collect_session_directories(sess); |
374 | 377 | } |
375 | 378 |
|
376 | | -pub fn delete_all_session_dir_contents(sess: &Session) -> io::Result<()> { |
| 379 | +pub(crate) fn delete_all_session_dir_contents(sess: &Session) -> io::Result<()> { |
377 | 380 | let sess_dir_iterator = sess.incr_comp_session_dir().read_dir()?; |
378 | 381 | for entry in sess_dir_iterator { |
379 | 382 | let entry = entry?; |
@@ -621,7 +624,7 @@ fn is_old_enough_to_be_collected(timestamp: SystemTime) -> bool { |
621 | 624 | } |
622 | 625 |
|
623 | 626 | /// Runs garbage collection for the current session. |
624 | | -pub fn garbage_collect_session_directories(sess: &Session) -> io::Result<()> { |
| 627 | +pub(crate) fn garbage_collect_session_directories(sess: &Session) -> io::Result<()> { |
625 | 628 | debug!("garbage_collect_session_directories() - begin"); |
626 | 629 |
|
627 | 630 | let session_directory = sess.incr_comp_session_dir(); |
|
0 commit comments