@@ -746,6 +746,8 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
746
746
tcx. ensure ( ) . hir_crate_items ( ( ) ) ;
747
747
tcx. ensure ( ) . stability_index ( ( ) ) ;
748
748
749
+ let has_cache = tcx. query_system . on_disk_cache . as_ref ( ) . map ( |cache| cache. has_cache ( ) ) . unwrap_or ( false ) ;
750
+
749
751
rustc_passes:: hir_id_validator:: check_crate ( tcx) ;
750
752
751
753
let sess = tcx. sess ;
@@ -763,13 +765,24 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
763
765
CStore :: from_tcx( tcx) . report_unused_deps( tcx) ;
764
766
} ,
765
767
{
766
- tcx. hir( ) . par_for_each_module( |module| {
768
+ if has_cache {
769
+ tcx. hir( ) . for_each_module( |module| {
770
+ tcx. ensure( ) . check_mod_loops( module) ;
771
+ tcx. ensure( ) . check_mod_attrs( module) ;
772
+ tcx. ensure( ) . check_mod_naked_functions( module) ;
773
+ tcx. ensure( ) . check_mod_unstable_api_usage( module) ;
774
+ tcx. ensure( ) . check_mod_const_bodies( module) ;
775
+ } ) ;
776
+ } else {
777
+ tcx. hir( ) . par_for_each_module( |module| {
767
778
tcx. ensure( ) . check_mod_loops( module) ;
768
779
tcx. ensure( ) . check_mod_attrs( module) ;
769
780
tcx. ensure( ) . check_mod_naked_functions( module) ;
770
781
tcx. ensure( ) . check_mod_unstable_api_usage( module) ;
771
782
tcx. ensure( ) . check_mod_const_bodies( module) ;
772
783
} ) ;
784
+ }
785
+
773
786
} ,
774
787
{
775
788
sess. time( "unused_lib_feature_checking" , || {
@@ -790,8 +803,6 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
790
803
// passes are timed inside typeck
791
804
rustc_hir_analysis:: check_crate ( tcx) ?;
792
805
793
- let has_cache = tcx. query_system . on_disk_cache . as_ref ( ) . map ( |cache| cache. has_cache ( ) ) . unwrap_or ( false ) ;
794
-
795
806
sess. time ( "MIR_borrow_checking" , || {
796
807
if has_cache {
797
808
for def_id in tcx. hir ( ) . body_owners ( ) {
@@ -872,7 +883,6 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
872
883
} ) ;
873
884
}
874
885
) ;
875
-
876
886
// This check has to be run after all lints are done processing. We don't
877
887
// define a lint filter, as all lint checks should have finished at this point.
878
888
sess. time ( "check_lint_expectations" , || tcx. check_expectations ( None ) ) ;
0 commit comments