@@ -658,8 +658,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
658658 let debugger_visualizers =
659659 stat ! ( "debugger-visualizers" , || self . encode_debugger_visualizers( ) ) ;
660660
661- // Encode exported symbols info. This is prefetched in `encode_metadata` so we encode
662- // this as late as possible to give the prefetching as much time as possible to complete.
661+ // Encode exported symbols info. This is prefetched in `encode_metadata`.
663662 let exported_symbols = stat ! ( "exported-symbols" , || {
664663 self . encode_exported_symbols( tcx. exported_symbols( LOCAL_CRATE ) )
665664 } ) ;
@@ -2193,21 +2192,13 @@ pub fn encode_metadata(tcx: TyCtxt<'_>, path: &Path) {
21932192 // there's no need to do dep-graph tracking for any of it.
21942193 tcx. dep_graph . assert_ignored ( ) ;
21952194
2196- join (
2197- || encode_metadata_impl ( tcx, path) ,
2198- || {
2199- if tcx. sess . threads ( ) == 1 {
2200- return ;
2201- }
2202- // Prefetch some queries used by metadata encoding.
2203- // This is not necessary for correctness, but is only done for performance reasons.
2204- // It can be removed if it turns out to cause trouble or be detrimental to performance.
2205- join ( || prefetch_mir ( tcx) , || tcx. exported_symbols ( LOCAL_CRATE ) ) ;
2206- } ,
2207- ) ;
2208- }
2195+ if tcx. sess . threads ( ) != 1 {
2196+ // Prefetch some queries used by metadata encoding.
2197+ // This is not necessary for correctness, but is only done for performance reasons.
2198+ // It can be removed if it turns out to cause trouble or be detrimental to performance.
2199+ join ( || prefetch_mir ( tcx) , || tcx. exported_symbols ( LOCAL_CRATE ) ) ;
2200+ }
22092201
2210- fn encode_metadata_impl ( tcx : TyCtxt < ' _ > , path : & Path ) {
22112202 let mut encoder = opaque:: FileEncoder :: new ( path)
22122203 . unwrap_or_else ( |err| tcx. sess . emit_fatal ( FailCreateFileEncoder { err } ) ) ;
22132204 encoder. emit_raw_bytes ( METADATA_HEADER ) ;
0 commit comments