11use std:: ops:: Range ;
22
3- use rustc_errors:: E0232 ;
4- use rustc_hir:: AttrPath ;
53use rustc_hir:: attrs:: diagnostic:: {
64 Directive , Filter , FilterFormatString , Flag , FormatArg , FormatString , LitOrArg , Name ,
75 NameValue , Piece , Predicate ,
86} ;
9- use rustc_macros:: Diagnostic ;
107use rustc_parse_format:: {
118 Argument , FormatSpec , ParseError , ParseMode , Parser , Piece as RpfPiece , Position ,
129} ;
@@ -17,9 +14,10 @@ use rustc_span::{Ident, InnerSpan, Span, Symbol, kw, sym};
1714use thin_vec:: { ThinVec , thin_vec} ;
1815
1916use crate :: context:: AcceptContext ;
20- use crate :: errors:: {
21- FormatWarning , IgnoredDiagnosticOption , MalFormedDiagnosticAttributeLint ,
22- MissingOptionsForDiagnosticAttribute , NonMetaItemDiagnosticAttribute , WrappedParserError ,
17+ use crate :: diagnostics:: {
18+ DupesNotAllowed , FormatWarning , IgnoredDiagnosticOption , InvalidOnClause ,
19+ MalFormedDiagnosticAttributeLint , MissingOptionsForDiagnosticAttribute ,
20+ NonMetaItemDiagnosticAttribute , WrappedParserError ,
2321} ;
2422use crate :: parser:: { ArgParser , MetaItemListParser , MetaItemOrLitParser , MetaItemParser } ;
2523
@@ -611,54 +609,3 @@ fn parse_filter_format(input: Symbol) -> FilterFormatString {
611609 . collect ( ) ;
612610 FilterFormatString { pieces }
613611}
614-
615- #[ derive( Diagnostic ) ]
616- pub ( crate ) enum InvalidOnClause {
617- #[ diag( "empty `on`-clause in `#[rustc_on_unimplemented]`" , code = E0232 ) ]
618- Empty {
619- #[ primary_span]
620- #[ label( "empty `on`-clause here" ) ]
621- span : Span ,
622- } ,
623- #[ diag( "expected a single predicate in `not(..)`" , code = E0232 ) ]
624- ExpectedOnePredInNot {
625- #[ primary_span]
626- #[ label( "unexpected quantity of predicates here" ) ]
627- span : Span ,
628- } ,
629- #[ diag( "literals inside `on`-clauses are not supported" , code = E0232 ) ]
630- UnsupportedLiteral {
631- #[ primary_span]
632- #[ label( "unexpected literal here" ) ]
633- span : Span ,
634- } ,
635- #[ diag( "expected an identifier inside this `on`-clause" , code = E0232 ) ]
636- ExpectedIdentifier {
637- #[ primary_span]
638- #[ label( "expected an identifier here, not `{$path}`" ) ]
639- span : Span ,
640- path : AttrPath ,
641- } ,
642- #[ diag( "this predicate is invalid" , code = E0232 ) ]
643- InvalidPredicate {
644- #[ primary_span]
645- #[ label( "expected one of `any`, `all` or `not` here, not `{$invalid_pred}`" ) ]
646- span : Span ,
647- invalid_pred : Symbol ,
648- } ,
649- #[ diag( "invalid flag in `on`-clause" , code = E0232 ) ]
650- InvalidFlag {
651- #[ primary_span]
652- #[ label(
653- "expected one of the `crate_local`, `direct` or `from_desugaring` flags, not `{$invalid_flag}`"
654- ) ]
655- span : Span ,
656- invalid_flag : Symbol ,
657- } ,
658- }
659-
660- #[ derive( Diagnostic ) ]
661- #[ diag(
662- "using multiple `rustc_on_unimplemented` (or mixing it with `diagnostic::on_unimplemented`) is not supported"
663- ) ]
664- pub ( crate ) struct DupesNotAllowed ;
0 commit comments