@@ -73,12 +73,22 @@ impl<T: Default> LoadResult<T> {
73
73
}
74
74
}
75
75
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 (
78
86
path : & Path ,
79
- nightly_build : bool ,
87
+ report_incremental_info : bool ,
88
+ is_nightly_build : bool ,
89
+ cfg_version : & ' static str ,
80
90
) -> 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 ) {
82
92
Ok ( Some ( data_and_pos) ) => LoadResult :: Ok { data : data_and_pos } ,
83
93
Ok ( None ) => {
84
94
// The file either didn't exist or was produced by an incompatible
@@ -138,14 +148,13 @@ pub fn load_dep_graph(sess: &Session) -> DepGraphFuture {
138
148
let expected_hash = sess. opts . dep_tracking_hash ( false ) ;
139
149
140
150
let mut prev_work_products = FxHashMap :: default ( ) ;
141
- let nightly_build = sess. is_nightly_build ( ) ;
142
151
143
152
// If we are only building with -Zquery-dep-graph but without an actual
144
153
// incr. comp. session directory, we skip this. Otherwise we'd fail
145
154
// when trying to load work products.
146
155
if sess. incr_comp_session_dir_opt ( ) . is_some ( ) {
147
156
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 ) ;
149
158
150
159
if let LoadResult :: Ok { data : ( work_products_data, start_pos) } = load_result {
151
160
// Decode the list of work_products
@@ -173,10 +182,13 @@ pub fn load_dep_graph(sess: &Session) -> DepGraphFuture {
173
182
}
174
183
}
175
184
185
+ let is_nightly_build = sess. is_nightly_build ( ) ;
186
+ let cfg_version = sess. cfg_version ;
187
+
176
188
MaybeAsync :: Async ( std:: thread:: spawn ( move || {
177
189
let _prof_timer = prof. generic_activity ( "incr_comp_load_dep_graph" ) ;
178
190
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 ) {
180
192
LoadResult :: DataOutOfDate => LoadResult :: DataOutOfDate ,
181
193
LoadResult :: LoadDepGraph ( path, err) => LoadResult :: LoadDepGraph ( path, err) ,
182
194
LoadResult :: DecodeIncrCache ( err) => LoadResult :: DecodeIncrCache ( err) ,
@@ -218,11 +230,7 @@ pub fn load_query_result_cache(sess: &Session) -> Option<OnDiskCache<'_>> {
218
230
219
231
let _prof_timer = sess. prof . generic_activity ( "incr_comp_load_query_result_cache" ) ;
220
232
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) {
226
234
LoadResult :: Ok { data : ( bytes, start_pos) } => {
227
235
Some ( OnDiskCache :: new ( sess, bytes, start_pos) )
228
236
}
0 commit comments