@@ -8,6 +8,7 @@ mod usefulness;
8
8
pub ( crate ) use self :: check_match:: check_match;
9
9
pub ( crate ) use self :: usefulness:: MatchCheckCtxt ;
10
10
11
+ use crate :: errors:: ConstPatternDependsOnGenericParameter ;
11
12
use crate :: thir:: util:: UserAnnotatedTyHelpers ;
12
13
13
14
use rustc_errors:: struct_span_err;
@@ -549,7 +550,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
549
550
Err ( ErrorHandled :: TooGeneric ) => {
550
551
// While `Reported | Linted` cases will have diagnostics emitted already
551
552
// it is not true for TooGeneric case, so we need to give user more information.
552
- self . tcx . sess . span_err ( span , "constant pattern depends on a generic parameter" ) ;
553
+ self . tcx . sess . emit_err ( ConstPatternDependsOnGenericParameter { span } ) ;
553
554
pat_from_kind ( PatKind :: Wild )
554
555
}
555
556
Err ( _) => {
@@ -583,9 +584,9 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
583
584
_ => bug ! ( "Expected ConstKind::Param" ) ,
584
585
} ,
585
586
mir:: ConstantKind :: Val ( _, _) => self . const_to_pat ( value, id, span, false ) . kind ,
586
- mir:: ConstantKind :: Unevaluated ( .. ) => {
587
+ mir:: ConstKind :: Unevaluated ( _ ) => {
587
588
// If we land here it means the const can't be evaluated because it's `TooGeneric`.
588
- self . tcx . sess . span_err ( span , "constant pattern depends on a generic parameter" ) ;
589
+ self . tcx . sess . emit_err ( ConstPatternDependsOnGenericParameter { span } ) ;
589
590
return PatKind :: Wild ;
590
591
}
591
592
}
0 commit comments