11//! Errors emitted by typeck.
2- use rustc_errors:: {
3- error_code, Applicability , DiagnosticBuilder , DiagnosticMessage , ErrorGuaranteed ,
4- } ;
2+ use rustc_errors:: { error_code, Applicability , DiagnosticBuilder , ErrorGuaranteed } ;
53use rustc_macros:: { SessionDiagnostic , SessionSubdiagnostic } ;
64use rustc_middle:: ty:: Ty ;
75use rustc_session:: { parse:: ParseSess , SessionDiagnostic } ;
@@ -264,10 +262,9 @@ pub struct MissingTypeParams {
264262// Manual implementation of `SessionDiagnostic` to be able to call `span_to_snippet`.
265263impl < ' a > SessionDiagnostic < ' a > for MissingTypeParams {
266264 fn into_diagnostic ( self , sess : & ' a ParseSess ) -> DiagnosticBuilder < ' a , ErrorGuaranteed > {
267- static SLUG : & ' static str = "typeck-missing-type-params" ;
268265 let mut err = sess. span_diagnostic . struct_span_err_with_code (
269266 self . span ,
270- DiagnosticMessage :: fluent ( SLUG ) ,
267+ rustc_errors :: fluent:: typeck :: missing_type_params ,
271268 error_code ! ( E0393 ) ,
272269 ) ;
273270 err. set_arg ( "parameterCount" , self . missing_type_params . len ( ) ) ;
@@ -280,7 +277,7 @@ impl<'a> SessionDiagnostic<'a> for MissingTypeParams {
280277 . join ( ", " ) ,
281278 ) ;
282279
283- err. span_label ( self . def_span , DiagnosticMessage :: fluent_attr ( SLUG , "label" ) ) ;
280+ err. span_label ( self . def_span , rustc_errors :: fluent :: typeck :: missing_type_params_label ) ;
284281
285282 let mut suggested = false ;
286283 if let ( Ok ( snippet) , true ) = (
@@ -298,18 +295,21 @@ impl<'a> SessionDiagnostic<'a> for MissingTypeParams {
298295 // least we can clue them to the correct syntax `Iterator<Type>`.
299296 err. span_suggestion (
300297 self . span ,
301- DiagnosticMessage :: fluent_attr ( SLUG , "suggestion" ) ,
298+ rustc_errors :: fluent :: typeck :: missing_type_params_suggestion ,
302299 format ! ( "{}<{}>" , snippet, self . missing_type_params. join( ", " ) ) ,
303300 Applicability :: HasPlaceholders ,
304301 ) ;
305302 suggested = true ;
306303 }
307304 }
308305 if !suggested {
309- err. span_label ( self . span , DiagnosticMessage :: fluent_attr ( SLUG , "no-suggestion-label" ) ) ;
306+ err. span_label (
307+ self . span ,
308+ rustc_errors:: fluent:: typeck:: missing_type_params_no_suggestion_label,
309+ ) ;
310310 }
311311
312- err. note ( DiagnosticMessage :: fluent_attr ( SLUG , "note" ) ) ;
312+ err. note ( rustc_errors :: fluent :: typeck :: missing_type_params_note ) ;
313313 err
314314 }
315315}
0 commit comments