|
1 | | -use rustc_errors::DiagArgValue; |
2 | 1 | use rustc_hir::attrs::MacroUseArgs; |
3 | 2 | use rustc_session::lint::builtin::INVALID_MACRO_EXPORT_ARGUMENTS; |
4 | 3 |
|
5 | 4 | use super::prelude::*; |
6 | | -use crate::session_diagnostics::IllFormedAttributeInputLint; |
7 | 5 |
|
8 | 6 | pub(crate) struct MacroEscapeParser; |
9 | 7 | impl<S: Stage> NoArgsAttributeParser<S> for MacroEscapeParser { |
@@ -101,15 +99,8 @@ impl<S: Stage> AttributeParser<S> for MacroUseParser { |
101 | 99 | } |
102 | 100 | } |
103 | 101 | } |
104 | | - ArgParser::NameValue(_) => { |
105 | | - let suggestions = cx.suggestions(); |
106 | | - cx.emit_err(IllFormedAttributeInputLint { |
107 | | - num_suggestions: suggestions.len(), |
108 | | - suggestions: DiagArgValue::StrListSepByAnd( |
109 | | - suggestions.into_iter().map(|s| format!("`{s}`").into()).collect(), |
110 | | - ), |
111 | | - span, |
112 | | - }); |
| 102 | + ArgParser::NameValue(nv) => { |
| 103 | + cx.expected_list_or_no_args(nv.args_span()); |
113 | 104 | } |
114 | 105 | } |
115 | 106 | }, |
@@ -164,16 +155,8 @@ impl<S: Stage> SingleAttributeParser<S> for MacroExportParser { |
164 | 155 | } |
165 | 156 | } |
166 | 157 | } |
167 | | - ArgParser::NameValue(_) => { |
168 | | - let span = cx.attr_span; |
169 | | - let suggestions = cx.suggestions(); |
170 | | - cx.emit_err(IllFormedAttributeInputLint { |
171 | | - num_suggestions: suggestions.len(), |
172 | | - suggestions: DiagArgValue::StrListSepByAnd( |
173 | | - suggestions.into_iter().map(|s| format!("`{s}`").into()).collect(), |
174 | | - ), |
175 | | - span, |
176 | | - }); |
| 158 | + ArgParser::NameValue(nv) => { |
| 159 | + cx.expected_list_or_no_args(nv.args_span()); |
177 | 160 | return None; |
178 | 161 | } |
179 | 162 | }; |
|
0 commit comments