@@ -6,7 +6,7 @@ use crate::astconv::{
66use crate :: errors:: AssocTypeBindingNotAllowed ;
77use crate :: structured_errors:: { GenericArgsInfo , StructuredDiagnostic , WrongNumberOfGenericArgs } ;
88use rustc_ast:: ast:: ParamKindOrd ;
9- use rustc_errors:: { struct_span_err, Applicability , Diagnostic , MultiSpan } ;
9+ use rustc_errors:: { struct_span_err, Applicability , Diagnostic , ErrorGuaranteed , MultiSpan } ;
1010use rustc_hir as hir;
1111use rustc_hir:: def:: { DefKind , Res } ;
1212use rustc_hir:: def_id:: DefId ;
@@ -26,7 +26,7 @@ fn generic_arg_mismatch_err(
2626 param : & GenericParamDef ,
2727 possible_ordering_error : bool ,
2828 help : Option < & str > ,
29- ) {
29+ ) -> ErrorGuaranteed {
3030 let sess = tcx. sess ;
3131 let mut err = struct_span_err ! (
3232 sess,
@@ -70,9 +70,9 @@ fn generic_arg_mismatch_err(
7070 ) => match path. res {
7171 Res :: Err => {
7272 add_braces_suggestion ( arg, & mut err) ;
73- err. set_primary_message ( "unresolved item provided when a constant was expected" )
73+ return err
74+ . set_primary_message ( "unresolved item provided when a constant was expected" )
7475 . emit ( ) ;
75- return ;
7676 }
7777 Res :: Def ( DefKind :: TyParam , src_def_id) => {
7878 if let Some ( param_local_id) = param. def_id . as_local ( ) {
@@ -81,7 +81,7 @@ fn generic_arg_mismatch_err(
8181 if param_type. is_suggestable ( tcx, false ) {
8282 err. span_suggestion (
8383 tcx. def_span ( src_def_id) ,
84- "consider changing this type parameter to be a ` const` generic " ,
84+ "consider changing this type parameter to a const parameter " ,
8585 format ! ( "const {}: {}" , param_name, param_type) ,
8686 Applicability :: MaybeIncorrect ,
8787 ) ;
@@ -137,7 +137,7 @@ fn generic_arg_mismatch_err(
137137 }
138138 }
139139
140- err. emit ( ) ;
140+ err. emit ( )
141141}
142142
143143/// Creates the relevant generic argument substitutions
0 commit comments