@@ -101,7 +101,7 @@ use rustc_middle::middle;
101
101
use rustc_middle:: mir:: interpret:: GlobalId ;
102
102
use rustc_middle:: query:: Providers ;
103
103
use rustc_middle:: ty:: { self , Const , Ty , TyCtxt } ;
104
- use rustc_span:: Span ;
104
+ use rustc_span:: { ErrorGuaranteed , Span } ;
105
105
use rustc_trait_selection:: traits;
106
106
107
107
use self :: hir_ty_lowering:: { FeedConstTy , HirTyLowerer } ;
@@ -139,16 +139,20 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
139
139
let _prof_timer = tcx. sess . timer ( "type_check_crate" ) ;
140
140
141
141
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
+
142
146
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) ;
144
148
} ) ;
145
149
146
150
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) ;
148
152
}
149
153
// 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 ( ( ) ) ;
152
156
} ) ;
153
157
154
158
if tcx. features ( ) . rustc_attrs ( ) {
0 commit comments