@@ -73,12 +73,22 @@ impl<T: Default> LoadResult<T> {
7373 }
7474}
7575
76- fn load_data (
77- report_incremental_info : bool ,
76+ fn load_data ( path : & Path , sess : & Session ) -> LoadResult < ( Mmap , usize ) > {
77+ load_data_no_sess (
78+ path,
79+ sess. opts . unstable_opts . incremental_info ,
80+ sess. is_nightly_build ( ) ,
81+ sess. cfg_version ,
82+ )
83+ }
84+
85+ fn load_data_no_sess (
7886 path : & Path ,
79- nightly_build : bool ,
87+ report_incremental_info : bool ,
88+ is_nightly_build : bool ,
89+ cfg_version : & ' static str ,
8090) -> LoadResult < ( Mmap , usize ) > {
81- match file_format:: read_file ( report_incremental_info, path , nightly_build ) {
91+ match file_format:: read_file ( path , report_incremental_info, is_nightly_build , cfg_version ) {
8292 Ok ( Some ( data_and_pos) ) => LoadResult :: Ok { data : data_and_pos } ,
8393 Ok ( None ) => {
8494 // The file either didn't exist or was produced by an incompatible
@@ -138,14 +148,13 @@ pub fn load_dep_graph(sess: &Session) -> DepGraphFuture {
138148 let expected_hash = sess. opts . dep_tracking_hash ( false ) ;
139149
140150 let mut prev_work_products = FxHashMap :: default ( ) ;
141- let nightly_build = sess. is_nightly_build ( ) ;
142151
143152 // If we are only building with -Zquery-dep-graph but without an actual
144153 // incr. comp. session directory, we skip this. Otherwise we'd fail
145154 // when trying to load work products.
146155 if sess. incr_comp_session_dir_opt ( ) . is_some ( ) {
147156 let work_products_path = work_products_path ( sess) ;
148- let load_result = load_data ( report_incremental_info , & work_products_path, nightly_build ) ;
157+ let load_result = load_data ( & work_products_path, sess ) ;
149158
150159 if let LoadResult :: Ok { data : ( work_products_data, start_pos) } = load_result {
151160 // Decode the list of work_products
@@ -173,10 +182,13 @@ pub fn load_dep_graph(sess: &Session) -> DepGraphFuture {
173182 }
174183 }
175184
185+ let is_nightly_build = sess. is_nightly_build ( ) ;
186+ let cfg_version = sess. cfg_version ;
187+
176188 MaybeAsync :: Async ( std:: thread:: spawn ( move || {
177189 let _prof_timer = prof. generic_activity ( "incr_comp_load_dep_graph" ) ;
178190
179- match load_data ( report_incremental_info, & path , nightly_build ) {
191+ match load_data_no_sess ( & path , report_incremental_info, is_nightly_build , cfg_version ) {
180192 LoadResult :: DataOutOfDate => LoadResult :: DataOutOfDate ,
181193 LoadResult :: LoadDepGraph ( path, err) => LoadResult :: LoadDepGraph ( path, err) ,
182194 LoadResult :: DecodeIncrCache ( err) => LoadResult :: DecodeIncrCache ( err) ,
@@ -218,11 +230,7 @@ pub fn load_query_result_cache(sess: &Session) -> Option<OnDiskCache<'_>> {
218230
219231 let _prof_timer = sess. prof . generic_activity ( "incr_comp_load_query_result_cache" ) ;
220232
221- match load_data (
222- sess. opts . unstable_opts . incremental_info ,
223- & query_cache_path ( sess) ,
224- sess. is_nightly_build ( ) ,
225- ) {
233+ match load_data ( & query_cache_path ( sess) , sess) {
226234 LoadResult :: Ok { data : ( bytes, start_pos) } => {
227235 Some ( OnDiskCache :: new ( sess, bytes, start_pos) )
228236 }
0 commit comments