@@ -7,18 +7,18 @@ use rustc_errors::codes::*;
77use rustc_errors:: { ErrorGuaranteed , struct_span_code_err} ;
88use rustc_hir:: def_id:: { DefId , LocalDefId } ;
99use rustc_hir:: { AttrArgs , Attribute } ;
10- use rustc_macros:: LintDiagnostic ;
1110use rustc_middle:: bug;
1211use rustc_middle:: ty:: print:: PrintTraitRefExt as _;
1312use rustc_middle:: ty:: { self , GenericArgsRef , GenericParamDefKind , TyCtxt } ;
1413use rustc_parse_format:: { ParseMode , Parser , Piece , Position } ;
1514use 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} ;
1716use tracing:: { debug, info} ;
1817use { rustc_attr_parsing as attr, rustc_hir as hir} ;
1918
2019use super :: { ObligationCauseCode , PredicateObligation } ;
2120use crate :: error_reporting:: TypeErrCtxt ;
21+ use crate :: error_reporting:: traits:: on_unimplemented_format:: errors:: * ;
2222use crate :: errors:: {
2323 EmptyOnClauseInOnUnimplemented , InvalidOnClauseInOnUnimplemented , NoValueInOnUnimplemented ,
2424} ;
@@ -320,81 +320,6 @@ pub enum AppendConstMessage {
320320 Custom ( Symbol , Span ) ,
321321}
322322
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-
398323impl < ' tcx > OnUnimplementedDirective {
399324 fn parse (
400325 tcx : TyCtxt < ' tcx > ,
0 commit comments