@@ -100,7 +100,7 @@ use rustc_middle::middle;
100100use rustc_middle:: mir:: interpret:: GlobalId ;
101101use rustc_middle:: query:: Providers ;
102102use rustc_middle:: ty:: { self , Const , Ty , TyCtxt } ;
103- use rustc_span:: Span ;
103+ use rustc_span:: { ErrorGuaranteed , Span } ;
104104use rustc_trait_selection:: traits;
105105
106106pub use crate :: collect:: suggest_impl_trait;
@@ -139,16 +139,20 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
139139 let _prof_timer = tcx. sess . timer ( "type_check_crate" ) ;
140140
141141 tcx. sess . time ( "coherence_checking" , || {
142+ // When discarding query call results, use an explicit type to indicate
143+ // what we are intending to discard, to help future type-based refactoring.
144+ type R = Result < ( ) , ErrorGuaranteed > ;
145+
142146 tcx. hir ( ) . par_for_each_module ( |module| {
143- let _ = tcx. ensure_ok ( ) . check_mod_type_wf ( module) ;
147+ let _: R = tcx. ensure_ok ( ) . check_mod_type_wf ( module) ;
144148 } ) ;
145149
146150 for & trait_def_id in tcx. all_local_trait_impls ( ( ) ) . keys ( ) {
147- let _ = tcx. ensure_ok ( ) . coherent_trait ( trait_def_id) ;
151+ let _: R = tcx. ensure_ok ( ) . coherent_trait ( trait_def_id) ;
148152 }
149153 // these queries are executed for side-effects (error reporting):
150- let _ = tcx. ensure_ok ( ) . crate_inherent_impls_validity_check ( ( ) ) ;
151- let _ = tcx. ensure_ok ( ) . crate_inherent_impls_overlap_check ( ( ) ) ;
154+ let _: R = tcx. ensure_ok ( ) . crate_inherent_impls_validity_check ( ( ) ) ;
155+ let _: R = tcx. ensure_ok ( ) . crate_inherent_impls_overlap_check ( ( ) ) ;
152156 } ) ;
153157
154158 if tcx. features ( ) . rustc_attrs ( ) {
0 commit comments