@@ -1794,6 +1794,10 @@ impl<'tcx, 'v> ParItemLikeVisitor<'v> for PrefetchVisitor<'tcx> {
17941794// generated regardless of trailing bytes that end up in it.
17951795
17961796pub ( super ) fn encode_metadata ( tcx : TyCtxt < ' _ > ) -> EncodedMetadata {
1797+ // Since encoding metadata is not in a query, and nothing is cached,
1798+ // there's no need to do dep-graph tracking for any of it.
1799+ tcx. dep_graph . assert_ignored ( ) ;
1800+
17971801 join (
17981802 || encode_metadata_impl ( tcx) ,
17991803 || {
@@ -1803,21 +1807,19 @@ pub(super) fn encode_metadata(tcx: TyCtxt<'_>) -> EncodedMetadata {
18031807 // Prefetch some queries used by metadata encoding.
18041808 // This is not necessary for correctness, but is only done for performance reasons.
18051809 // It can be removed if it turns out to cause trouble or be detrimental to performance.
1806- tcx. dep_graph . with_ignore ( || {
1807- join (
1808- || {
1809- if !tcx. sess . opts . output_types . should_codegen ( ) {
1810- // We won't emit MIR, so don't prefetch it.
1811- return ;
1812- }
1813- tcx. hir ( ) . krate ( ) . par_visit_all_item_likes ( & PrefetchVisitor {
1814- tcx,
1815- mir_keys : tcx. mir_keys ( LOCAL_CRATE ) ,
1816- } ) ;
1817- } ,
1818- || tcx. exported_symbols ( LOCAL_CRATE ) ,
1819- ) ;
1820- } )
1810+ join (
1811+ || {
1812+ if !tcx. sess . opts . output_types . should_codegen ( ) {
1813+ // We won't emit MIR, so don't prefetch it.
1814+ return ;
1815+ }
1816+ tcx. hir ( ) . krate ( ) . par_visit_all_item_likes ( & PrefetchVisitor {
1817+ tcx,
1818+ mir_keys : tcx. mir_keys ( LOCAL_CRATE ) ,
1819+ } ) ;
1820+ } ,
1821+ || tcx. exported_symbols ( LOCAL_CRATE ) ,
1822+ ) ;
18211823 } ,
18221824 )
18231825 . 0
@@ -1830,29 +1832,26 @@ fn encode_metadata_impl(tcx: TyCtxt<'_>) -> EncodedMetadata {
18301832 // Will be filled with the root position after encoding everything.
18311833 encoder. emit_raw_bytes ( & [ 0 , 0 , 0 , 0 ] ) ;
18321834
1833- // Since encoding metadata is not in a query, and nothing is cached,
1834- // there's no need to do dep-graph tracking for any of it.
1835- let ( root, mut result) = tcx. dep_graph . with_ignore ( move || {
1836- let mut ecx = EncodeContext {
1837- opaque : encoder,
1838- tcx,
1839- per_def : Default :: default ( ) ,
1840- lazy_state : LazyState :: NoNode ,
1841- type_shorthands : Default :: default ( ) ,
1842- predicate_shorthands : Default :: default ( ) ,
1843- source_file_cache : tcx. sess . source_map ( ) . files ( ) [ 0 ] . clone ( ) ,
1844- interpret_allocs : Default :: default ( ) ,
1845- interpret_allocs_inverse : Default :: default ( ) ,
1846- } ;
1847-
1848- // Encode the rustc version string in a predictable location.
1849- rustc_version ( ) . encode ( & mut ecx) . unwrap ( ) ;
1850-
1851- // Encode all the entries and extra information in the crate,
1852- // culminating in the `CrateRoot` which points to all of it.
1853- let root = ecx. encode_crate_root ( ) ;
1854- ( root, ecx. opaque . into_inner ( ) )
1855- } ) ;
1835+ let mut ecx = EncodeContext {
1836+ opaque : encoder,
1837+ tcx,
1838+ per_def : Default :: default ( ) ,
1839+ lazy_state : LazyState :: NoNode ,
1840+ type_shorthands : Default :: default ( ) ,
1841+ predicate_shorthands : Default :: default ( ) ,
1842+ source_file_cache : tcx. sess . source_map ( ) . files ( ) [ 0 ] . clone ( ) ,
1843+ interpret_allocs : Default :: default ( ) ,
1844+ interpret_allocs_inverse : Default :: default ( ) ,
1845+ } ;
1846+
1847+ // Encode the rustc version string in a predictable location.
1848+ rustc_version ( ) . encode ( & mut ecx) . unwrap ( ) ;
1849+
1850+ // Encode all the entries and extra information in the crate,
1851+ // culminating in the `CrateRoot` which points to all of it.
1852+ let root = ecx. encode_crate_root ( ) ;
1853+
1854+ let mut result = ecx. opaque . into_inner ( ) ;
18561855
18571856 // Encode the root position.
18581857 let header = METADATA_HEADER . len ( ) ;
0 commit comments