@@ -7,18 +7,18 @@ use rustc_errors::codes::*;
7
7
use rustc_errors:: { ErrorGuaranteed , struct_span_code_err} ;
8
8
use rustc_hir:: def_id:: { DefId , LocalDefId } ;
9
9
use rustc_hir:: { AttrArgs , Attribute } ;
10
- use rustc_macros:: LintDiagnostic ;
11
10
use rustc_middle:: bug;
12
11
use rustc_middle:: ty:: print:: PrintTraitRefExt as _;
13
12
use rustc_middle:: ty:: { self , GenericArgsRef , GenericParamDefKind , TyCtxt } ;
14
13
use rustc_parse_format:: { ParseMode , Parser , Piece , Position } ;
15
14
use rustc_session:: lint:: builtin:: UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES ;
16
- use rustc_span:: { Ident , Span , Symbol , kw, sym} ;
15
+ use rustc_span:: { Span , Symbol , kw, sym} ;
17
16
use tracing:: { debug, info} ;
18
17
use { rustc_attr_parsing as attr, rustc_hir as hir} ;
19
18
20
19
use super :: { ObligationCauseCode , PredicateObligation } ;
21
20
use crate :: error_reporting:: TypeErrCtxt ;
21
+ use crate :: error_reporting:: traits:: on_unimplemented_format:: errors:: * ;
22
22
use crate :: errors:: {
23
23
EmptyOnClauseInOnUnimplemented , InvalidOnClauseInOnUnimplemented , NoValueInOnUnimplemented ,
24
24
} ;
@@ -320,81 +320,6 @@ pub enum AppendConstMessage {
320
320
Custom ( Symbol , Span ) ,
321
321
}
322
322
323
- #[ derive( LintDiagnostic ) ]
324
- #[ diag( trait_selection_malformed_on_unimplemented_attr) ]
325
- #[ help]
326
- pub struct MalformedOnUnimplementedAttrLint {
327
- #[ label]
328
- pub span : Span ,
329
- }
330
-
331
- impl MalformedOnUnimplementedAttrLint {
332
- fn new ( span : Span ) -> Self {
333
- Self { span }
334
- }
335
- }
336
-
337
- #[ derive( LintDiagnostic ) ]
338
- #[ diag( trait_selection_missing_options_for_on_unimplemented_attr) ]
339
- #[ help]
340
- pub struct MissingOptionsForOnUnimplementedAttr ;
341
-
342
- #[ derive( LintDiagnostic ) ]
343
- #[ diag( trait_selection_ignored_diagnostic_option) ]
344
- pub struct IgnoredDiagnosticOption {
345
- pub option_name : & ' static str ,
346
- #[ label]
347
- pub span : Span ,
348
- #[ label( trait_selection_other_label) ]
349
- pub prev_span : Span ,
350
- }
351
-
352
- impl IgnoredDiagnosticOption {
353
- fn maybe_emit_warning < ' tcx > (
354
- tcx : TyCtxt < ' tcx > ,
355
- item_def_id : DefId ,
356
- new : Option < Span > ,
357
- old : Option < Span > ,
358
- option_name : & ' static str ,
359
- ) {
360
- if let ( Some ( new_item) , Some ( old_item) ) = ( new, old) {
361
- if let Some ( item_def_id) = item_def_id. as_local ( ) {
362
- tcx. emit_node_span_lint (
363
- UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES ,
364
- tcx. local_def_id_to_hir_id ( item_def_id) ,
365
- new_item,
366
- IgnoredDiagnosticOption { span : new_item, prev_span : old_item, option_name } ,
367
- ) ;
368
- }
369
- }
370
- }
371
- }
372
-
373
- #[ derive( LintDiagnostic ) ]
374
- #[ diag( trait_selection_unknown_format_parameter_for_on_unimplemented_attr) ]
375
- #[ help]
376
- pub struct UnknownFormatParameterForOnUnimplementedAttr {
377
- argument_name : Symbol ,
378
- trait_name : Ident ,
379
- }
380
-
381
- #[ derive( LintDiagnostic ) ]
382
- #[ diag( trait_selection_disallowed_positional_argument) ]
383
- #[ help]
384
- pub struct DisallowedPositionalArgument ;
385
-
386
- #[ derive( LintDiagnostic ) ]
387
- #[ diag( trait_selection_invalid_format_specifier) ]
388
- #[ help]
389
- pub struct InvalidFormatSpecifier ;
390
-
391
- #[ derive( LintDiagnostic ) ]
392
- #[ diag( trait_selection_wrapped_parser_error) ]
393
- pub struct WrappedParserError {
394
- description : String ,
395
- label : String ,
396
- }
397
-
398
323
impl < ' tcx > OnUnimplementedDirective {
399
324
fn parse (
400
325
tcx : TyCtxt < ' tcx > ,
0 commit comments