@@ -183,17 +183,10 @@ pub(crate) fn type_check<'mir, 'tcx>(
183
183
& mut borrowck_context,
184
184
) ;
185
185
186
- let errors_reported = {
187
- let mut verifier = TypeVerifier :: new ( & mut checker, promoted) ;
188
- verifier. visit_body ( & body) ;
189
- verifier. errors_reported
190
- } ;
191
-
192
- if !errors_reported {
193
- // if verifier failed, don't do further checks to avoid ICEs
194
- checker. typeck_mir ( body) ;
195
- }
186
+ let mut verifier = TypeVerifier :: new ( & mut checker, promoted) ;
187
+ verifier. visit_body ( & body) ;
196
188
189
+ checker. typeck_mir ( body) ;
197
190
checker. equate_inputs_and_outputs ( & body, universal_regions, & normalized_inputs_and_output) ;
198
191
checker. check_signature_annotation ( & body) ;
199
192
@@ -294,7 +287,6 @@ struct TypeVerifier<'a, 'b, 'tcx> {
294
287
cx : & ' a mut TypeChecker < ' b , ' tcx > ,
295
288
promoted : & ' b IndexSlice < Promoted , Body < ' tcx > > ,
296
289
last_span : Span ,
297
- errors_reported : bool ,
298
290
}
299
291
300
292
impl < ' a , ' b , ' tcx > Visitor < ' tcx > for TypeVerifier < ' a , ' b , ' tcx > {
@@ -383,13 +375,11 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
383
375
} ;
384
376
} ;
385
377
386
- if !self . errors_reported {
387
- let promoted_body = & self . promoted [ promoted] ;
388
- self . sanitize_promoted ( promoted_body, location) ;
378
+ let promoted_body = & self . promoted [ promoted] ;
379
+ self . sanitize_promoted ( promoted_body, location) ;
389
380
390
- let promoted_ty = promoted_body. return_ty ( ) ;
391
- check_err ( self , promoted_body, ty, promoted_ty) ;
392
- }
381
+ let promoted_ty = promoted_body. return_ty ( ) ;
382
+ check_err ( self , promoted_body, ty, promoted_ty) ;
393
383
} else {
394
384
self . cx . ascribe_user_type (
395
385
constant. literal . ty ( ) ,
@@ -483,9 +473,6 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
483
473
for local_decl in & body. local_decls {
484
474
self . sanitize_type ( local_decl, local_decl. ty ) ;
485
475
}
486
- if self . errors_reported {
487
- return ;
488
- }
489
476
self . super_body ( body) ;
490
477
}
491
478
}
@@ -495,7 +482,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
495
482
cx : & ' a mut TypeChecker < ' b , ' tcx > ,
496
483
promoted : & ' b IndexSlice < Promoted , Body < ' tcx > > ,
497
484
) -> Self {
498
- TypeVerifier { promoted, last_span : cx. body . span , cx, errors_reported : false }
485
+ TypeVerifier { promoted, last_span : cx. body . span , cx }
499
486
}
500
487
501
488
fn body ( & self ) -> & Body < ' tcx > {
@@ -529,7 +516,6 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
529
516
for elem in place. projection . iter ( ) {
530
517
if place_ty. variant_index . is_none ( ) {
531
518
if let Err ( guar) = place_ty. ty . error_reported ( ) {
532
- assert ! ( self . errors_reported) ;
533
519
return PlaceTy :: from_ty ( self . tcx ( ) . ty_error ( guar) ) ;
534
520
}
535
521
}
@@ -593,10 +579,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
593
579
594
580
self . visit_body ( & promoted_body) ;
595
581
596
- if !self . errors_reported {
597
- // if verifier failed, don't do further checks to avoid ICEs
598
- self . cx . typeck_mir ( promoted_body) ;
599
- }
582
+ self . cx . typeck_mir ( promoted_body) ;
600
583
601
584
self . cx . body = parent_body;
602
585
// Merge the outlives constraints back in, at the given location.
@@ -762,7 +745,6 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
762
745
}
763
746
764
747
fn error ( & mut self ) -> Ty < ' tcx > {
765
- self . errors_reported = true ;
766
748
self . tcx ( ) . ty_error_misc ( )
767
749
}
768
750
0 commit comments