@@ -8,6 +8,7 @@ mod usefulness;
88pub ( crate ) use self :: check_match:: check_match;
99pub ( crate ) use self :: usefulness:: MatchCheckCtxt ;
1010
11+ use crate :: errors:: ConstPatternDependsOnGenericParameter ;
1112use crate :: thir:: util:: UserAnnotatedTyHelpers ;
1213
1314use rustc_errors:: struct_span_err;
@@ -549,7 +550,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
549550 Err ( ErrorHandled :: TooGeneric ) => {
550551 // While `Reported | Linted` cases will have diagnostics emitted already
551552 // 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 } ) ;
553554 pat_from_kind ( PatKind :: Wild )
554555 }
555556 Err ( _) => {
@@ -583,9 +584,9 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
583584 _ => bug ! ( "Expected ConstKind::Param" ) ,
584585 } ,
585586 mir:: ConstantKind :: Val ( _, _) => self . const_to_pat ( value, id, span, false ) . kind ,
586- mir:: ConstantKind :: Unevaluated ( .. ) => {
587+ mir:: ConstKind :: Unevaluated ( _ ) => {
587588 // 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 } ) ;
589590 return PatKind :: Wild ;
590591 }
591592 }
0 commit comments