@@ -6,7 +6,7 @@ use crate::astconv::{
6
6
use crate :: errors:: AssocTypeBindingNotAllowed ;
7
7
use crate :: structured_errors:: { GenericArgsInfo , StructuredDiagnostic , WrongNumberOfGenericArgs } ;
8
8
use 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 } ;
10
10
use rustc_hir as hir;
11
11
use rustc_hir:: def:: { DefKind , Res } ;
12
12
use rustc_hir:: def_id:: DefId ;
@@ -26,7 +26,7 @@ fn generic_arg_mismatch_err(
26
26
param : & GenericParamDef ,
27
27
possible_ordering_error : bool ,
28
28
help : Option < & str > ,
29
- ) {
29
+ ) -> ErrorGuaranteed {
30
30
let sess = tcx. sess ;
31
31
let mut err = struct_span_err ! (
32
32
sess,
@@ -70,9 +70,9 @@ fn generic_arg_mismatch_err(
70
70
) => match path. res {
71
71
Res :: Err => {
72
72
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" )
74
75
. emit ( ) ;
75
- return ;
76
76
}
77
77
Res :: Def ( DefKind :: TyParam , src_def_id) => {
78
78
if let Some ( param_local_id) = param. def_id . as_local ( ) {
@@ -81,7 +81,7 @@ fn generic_arg_mismatch_err(
81
81
if param_type. is_suggestable ( tcx, false ) {
82
82
err. span_suggestion (
83
83
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 " ,
85
85
format ! ( "const {}: {}" , param_name, param_type) ,
86
86
Applicability :: MaybeIncorrect ,
87
87
) ;
@@ -137,7 +137,7 @@ fn generic_arg_mismatch_err(
137
137
}
138
138
}
139
139
140
- err. emit ( ) ;
140
+ err. emit ( )
141
141
}
142
142
143
143
/// Creates the relevant generic argument substitutions
0 commit comments