@@ -95,6 +95,44 @@ fn merge<T, S: Stage>(
9595 }
9696}
9797
98+ fn parse_list < ' p , S : Stage > (
99+ cx : & mut AcceptContext < ' _ , ' _ , S > ,
100+ args : & ' p ArgParser ,
101+ mode : Mode ,
102+ ) -> Option < & ' p MetaItemListParser > {
103+ let span = cx. attr_span ;
104+ match args {
105+ ArgParser :: List ( items) if items. len ( ) != 0 => return Some ( items) ,
106+ ArgParser :: List ( list) => {
107+ // We're dealing with `#[diagnostic::attr()]`.
108+ // This can be because that is what the user typed, but that's also what we'd see
109+ // if the user used non-metaitem syntax. See `ArgParser::from_attr_args`.
110+ cx. emit_lint (
111+ MALFORMED_DIAGNOSTIC_ATTRIBUTES ,
112+ AttributeLintKind :: NonMetaItemDiagnosticAttribute ,
113+ list. span ,
114+ ) ;
115+ }
116+ ArgParser :: NoArgs => {
117+ cx. emit_lint (
118+ MALFORMED_DIAGNOSTIC_ATTRIBUTES ,
119+ AttributeLintKind :: MissingOptionsForDiagnosticAttribute {
120+ attribute : mode. as_str ( ) ,
121+ } ,
122+ span,
123+ ) ;
124+ }
125+ ArgParser :: NameValue ( _) => {
126+ cx. emit_lint (
127+ MALFORMED_DIAGNOSTIC_ATTRIBUTES ,
128+ AttributeLintKind :: MalFormedDiagnosticAttribute { attribute : mode. as_str ( ) , span } ,
129+ span,
130+ ) ;
131+ }
132+ }
133+ None
134+ }
135+
98136fn parse_directive_items < ' p , S : Stage > (
99137 cx : & mut AcceptContext < ' _ , ' _ , S > ,
100138 mode : Mode ,
0 commit comments