File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
src/librustc_metadata/rmeta Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ use rustc_index::vec::Idx;
21
21
use rustc:: session:: config:: { self , CrateType } ;
22
22
use rustc_data_structures:: fx:: FxHashMap ;
23
23
use rustc_data_structures:: stable_hasher:: StableHasher ;
24
- use rustc_data_structures:: sync:: Lrc ;
24
+ use rustc_data_structures:: sync:: { join , par_for_each_in , Lrc } ;
25
25
use rustc_serialize:: { opaque, Encodable , Encoder , SpecializedEncoder } ;
26
26
27
27
use log:: { debug, trace} ;
@@ -1705,6 +1705,22 @@ impl<'tcx, 'v> ItemLikeVisitor<'v> for ImplVisitor<'tcx> {
1705
1705
// generated regardless of trailing bytes that end up in it.
1706
1706
1707
1707
pub ( super ) fn encode_metadata ( tcx : TyCtxt < ' _ > ) -> EncodedMetadata {
1708
+ join (
1709
+ || encode_metadata_impl ( tcx) ,
1710
+ || {
1711
+ // Prefetch some queries used by metadata encoding
1712
+ tcx. dep_graph . with_ignore ( || {
1713
+ par_for_each_in ( tcx. mir_keys ( LOCAL_CRATE ) , |& def_id| {
1714
+ tcx. optimized_mir ( def_id) ;
1715
+ tcx. promoted_mir ( def_id) ;
1716
+ } ) ;
1717
+ } )
1718
+ } ,
1719
+ )
1720
+ . 0
1721
+ }
1722
+
1723
+ fn encode_metadata_impl ( tcx : TyCtxt < ' _ > ) -> EncodedMetadata {
1708
1724
let mut encoder = opaque:: Encoder :: new ( vec ! [ ] ) ;
1709
1725
encoder. emit_raw_bytes ( METADATA_HEADER ) ;
1710
1726
You can’t perform that action at this time.
0 commit comments