@@ -12,7 +12,6 @@ use rustc_middle::mir::interpret::Scalar;
12
12
use rustc_middle:: mir:: { self , Const } ;
13
13
use rustc_middle:: thir:: { FieldPat , Pat , PatKind , PatRange , PatRangeBoundary } ;
14
14
use rustc_middle:: ty:: layout:: IntegerExt ;
15
- use rustc_middle:: ty:: TypeVisitableExt ;
16
15
use rustc_middle:: ty:: { self , OpaqueTypeKey , Ty , TyCtxt , VariantDef } ;
17
16
use rustc_span:: ErrorGuaranteed ;
18
17
use rustc_span:: { Span , DUMMY_SP } ;
@@ -316,8 +315,6 @@ impl<'p, 'tcx> RustcMatchCheckCtxt<'p, 'tcx> {
316
315
RangeEnd :: Included ,
317
316
)
318
317
} ;
319
- // Abort on type error.
320
- ty. error_reported ( ) ?;
321
318
// This determines the set of all possible constructors for the type `ty`. For numbers,
322
319
// arrays and slices we use ranges and variable-length slices when appropriate.
323
320
Ok ( match ty. kind ( ) {
@@ -425,8 +422,11 @@ impl<'p, 'tcx> RustcMatchCheckCtxt<'p, 'tcx> {
425
422
| ty:: Closure ( _, _)
426
423
| ty:: Coroutine ( _, _)
427
424
| ty:: Alias ( _, _)
428
- | ty:: Param ( _)
429
- | ty:: Error ( _) => ConstructorSet :: Unlistable ,
425
+ | ty:: Param ( _) => ConstructorSet :: Unlistable ,
426
+ ty:: Error ( err) => {
427
+ // Abort on type error.
428
+ return Err ( * err) ;
429
+ }
430
430
ty:: CoroutineWitness ( _, _) | ty:: Bound ( _, _) | ty:: Placeholder ( _) | ty:: Infer ( _) => {
431
431
bug ! ( "Encountered unexpected type in `ConstructorSet::for_ty`: {ty:?}" )
432
432
}
0 commit comments