@@ -13,6 +13,7 @@ use rustc::session::Session;
13
13
use rustc:: ty:: TyCtxt ;
14
14
use rustc:: util:: common:: time;
15
15
use rustc_data_structures:: fx:: FxHashMap ;
16
+ use rustc_data_structures:: sync:: join;
16
17
use rustc_serialize:: Encodable as RustcEncodable ;
17
18
use rustc_serialize:: opaque:: Encoder ;
18
19
use std:: io:: { self , Cursor } ;
@@ -33,23 +34,28 @@ pub fn save_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
33
34
return ;
34
35
}
35
36
36
- time ( sess, "persist query result cache" , || {
37
- save_in ( sess,
38
- query_cache_path ( sess) ,
39
- |e| encode_query_cache ( tcx, e) ) ;
40
- } ) ;
37
+ let query_cache_path = query_cache_path ( sess) ;
38
+ let dep_graph_path = dep_graph_path ( sess) ;
41
39
42
- if tcx. sess . opts . debugging_opts . incremental_queries {
40
+ join ( move || {
41
+ if tcx. sess . opts . debugging_opts . incremental_queries {
42
+ time ( sess, "persist query result cache" , || {
43
+ save_in ( sess,
44
+ query_cache_path,
45
+ |e| encode_query_cache ( tcx, e) ) ;
46
+ } ) ;
47
+ }
48
+ } , || {
43
49
time ( sess, "persist dep-graph" , || {
44
50
save_in ( sess,
45
- dep_graph_path ( sess ) ,
51
+ dep_graph_path,
46
52
|e| {
47
53
time ( sess, "encode dep-graph" , || {
48
54
encode_dep_graph ( tcx, e)
49
55
} )
50
56
} ) ;
51
57
} ) ;
52
- }
58
+ } ) ;
53
59
54
60
dirty_clean:: check_dirty_clean_annotations ( tcx) ;
55
61
} )
0 commit comments