1
1
//! 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 } ;
5
3
use rustc_macros:: { SessionDiagnostic , SessionSubdiagnostic } ;
6
4
use rustc_middle:: ty:: Ty ;
7
5
use rustc_session:: { parse:: ParseSess , SessionDiagnostic } ;
@@ -264,10 +262,9 @@ pub struct MissingTypeParams {
264
262
// Manual implementation of `SessionDiagnostic` to be able to call `span_to_snippet`.
265
263
impl < ' a > SessionDiagnostic < ' a > for MissingTypeParams {
266
264
fn into_diagnostic ( self , sess : & ' a ParseSess ) -> DiagnosticBuilder < ' a , ErrorGuaranteed > {
267
- static SLUG : & ' static str = "typeck-missing-type-params" ;
268
265
let mut err = sess. span_diagnostic . struct_span_err_with_code (
269
266
self . span ,
270
- DiagnosticMessage :: fluent ( SLUG ) ,
267
+ rustc_errors :: fluent:: typeck :: missing_type_params ,
271
268
error_code ! ( E0393 ) ,
272
269
) ;
273
270
err. set_arg ( "parameterCount" , self . missing_type_params . len ( ) ) ;
@@ -280,7 +277,7 @@ impl<'a> SessionDiagnostic<'a> for MissingTypeParams {
280
277
. join ( ", " ) ,
281
278
) ;
282
279
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 ) ;
284
281
285
282
let mut suggested = false ;
286
283
if let ( Ok ( snippet) , true ) = (
@@ -298,18 +295,21 @@ impl<'a> SessionDiagnostic<'a> for MissingTypeParams {
298
295
// least we can clue them to the correct syntax `Iterator<Type>`.
299
296
err. span_suggestion (
300
297
self . span ,
301
- DiagnosticMessage :: fluent_attr ( SLUG , "suggestion" ) ,
298
+ rustc_errors :: fluent :: typeck :: missing_type_params_suggestion ,
302
299
format ! ( "{}<{}>" , snippet, self . missing_type_params. join( ", " ) ) ,
303
300
Applicability :: HasPlaceholders ,
304
301
) ;
305
302
suggested = true ;
306
303
}
307
304
}
308
305
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
+ ) ;
310
310
}
311
311
312
- err. note ( DiagnosticMessage :: fluent_attr ( SLUG , "note" ) ) ;
312
+ err. note ( rustc_errors :: fluent :: typeck :: missing_type_params_note ) ;
313
313
err
314
314
}
315
315
}
0 commit comments