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;
2121use rustc:: session:: config:: { self , CrateType } ;
2222use rustc_data_structures:: fx:: FxHashMap ;
2323use 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 } ;
2525use rustc_serialize:: { opaque, Encodable , Encoder , SpecializedEncoder } ;
2626
2727use log:: { debug, trace} ;
@@ -1705,6 +1705,22 @@ impl<'tcx, 'v> ItemLikeVisitor<'v> for ImplVisitor<'tcx> {
17051705// generated regardless of trailing bytes that end up in it.
17061706
17071707pub ( 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 {
17081724 let mut encoder = opaque:: Encoder :: new ( vec ! [ ] ) ;
17091725 encoder. emit_raw_bytes ( METADATA_HEADER ) ;
17101726
You can’t perform that action at this time.
0 commit comments