@@ -116,8 +116,6 @@ use rustc_data_structures::unord::{UnordMap, UnordSet};
116116use rustc_data_structures:: { base_n, flock} ;
117117use rustc_fs_util:: { LinkOrCopy , link_or_copy, try_canonicalize} ;
118118use rustc_middle:: bug;
119- use rustc_session:: config:: CrateType ;
120- use rustc_session:: output:: collect_crate_types;
121119use rustc_session:: { Session , StableCrateId } ;
122120use rustc_span:: Symbol ;
123121use tracing:: debug;
@@ -212,7 +210,11 @@ pub fn in_incr_comp_dir(incr_comp_session_dir: &Path, file_name: &str) -> PathBu
212210/// The garbage collection will take care of it.
213211///
214212/// [`rustc_interface::queries::dep_graph`]: ../../rustc_interface/struct.Queries.html#structfield.dep_graph
215- pub ( crate ) fn prepare_session_directory ( sess : & Session , crate_name : Symbol ) {
213+ pub ( crate ) fn prepare_session_directory (
214+ sess : & Session ,
215+ crate_name : Symbol ,
216+ stable_crate_id : StableCrateId ,
217+ ) {
216218 if sess. opts . incremental . is_none ( ) {
217219 return ;
218220 }
@@ -222,7 +224,7 @@ pub(crate) fn prepare_session_directory(sess: &Session, crate_name: Symbol) {
222224 debug ! ( "prepare_session_directory" ) ;
223225
224226 // {incr-comp-dir}/{crate-name-and-disambiguator}
225- let crate_dir = crate_path ( sess, crate_name) ;
227+ let crate_dir = crate_path ( sess, crate_name, stable_crate_id ) ;
226228 debug ! ( "crate-dir: {}" , crate_dir. display( ) ) ;
227229 create_dir ( sess, & crate_dir, "crate" ) ;
228230
@@ -595,17 +597,9 @@ fn string_to_timestamp(s: &str) -> Result<SystemTime, &'static str> {
595597 Ok ( UNIX_EPOCH + duration)
596598}
597599
598- fn crate_path ( sess : & Session , crate_name : Symbol ) -> PathBuf {
600+ fn crate_path ( sess : & Session , crate_name : Symbol , stable_crate_id : StableCrateId ) -> PathBuf {
599601 let incr_dir = sess. opts . incremental . as_ref ( ) . unwrap ( ) . clone ( ) ;
600602
601- let crate_types = collect_crate_types ( sess, & [ ] ) ;
602- let stable_crate_id = StableCrateId :: new (
603- crate_name,
604- crate_types. contains ( & CrateType :: Executable ) ,
605- sess. opts . cg . metadata . clone ( ) ,
606- sess. cfg_version ,
607- ) ;
608-
609603 let crate_name =
610604 format ! ( "{crate_name}-{}" , stable_crate_id. as_u64( ) . to_base_fixed_len( CASE_INSENSITIVE ) ) ;
611605 incr_dir. join ( crate_name)
0 commit comments