@@ -21,6 +21,7 @@ use crate::attributes::deprecation::DeprecationParser;
2121use crate :: attributes:: inline:: { InlineParser , RustcForceInlineParser } ;
2222use crate :: attributes:: lint_helpers:: AsPtrParser ;
2323use crate :: attributes:: repr:: { AlignParser , ReprParser } ;
24+ use crate :: attributes:: resolution:: SkipDuringMethodDispatchParser ;
2425use crate :: attributes:: stability:: {
2526 BodyStabilityParser , ConstStabilityIndirectParser , ConstStabilityParser , StabilityParser ,
2627} ;
@@ -112,6 +113,7 @@ attribute_parsers!(
112113 Single <InlineParser >,
113114 Single <OptimizeParser >,
114115 Single <RustcForceInlineParser >,
116+ Single <SkipDuringMethodDispatchParser >,
115117 Single <TransparencyParser >,
116118 // tidy-alphabetical-end
117119 ] ;
@@ -235,14 +237,22 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
235237 } )
236238 }
237239
238- pub ( crate ) fn expected_no_args ( & self , args_span : Span ) -> ErrorGuaranteed {
239- self . emit_err ( AttributeParseError {
240- span : args_span,
241- attr_span : self . attr_span ,
242- template : self . template . clone ( ) ,
243- attribute : self . attr_path . clone ( ) ,
244- reason : AttributeParseErrorReason :: ExpectedNoArgs ,
245- } )
240+ pub ( crate ) fn expect_no_args ( & self , args : & ArgParser < ' _ > ) -> Result < ( ) , ErrorGuaranteed > {
241+ if let Some ( span) = match args {
242+ ArgParser :: NoArgs => None ,
243+ ArgParser :: List ( args) => Some ( args. span ) ,
244+ ArgParser :: NameValue ( args) => Some ( args. eq_span . to ( args. value_span ) ) ,
245+ } {
246+ Err ( self . emit_err ( AttributeParseError {
247+ span,
248+ attr_span : self . attr_span ,
249+ template : self . template . clone ( ) ,
250+ attribute : self . attr_path . clone ( ) ,
251+ reason : AttributeParseErrorReason :: ExpectedNoArgs ,
252+ } ) )
253+ } else {
254+ Ok ( ( ) )
255+ }
246256 }
247257
248258 /// emit an error that a `name = value` pair was expected at this span. The symbol can be given for
@@ -290,6 +300,16 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
290300 } )
291301 }
292302
303+ pub ( crate ) fn expected_at_least_one_argument ( & self , span : Span ) -> ErrorGuaranteed {
304+ self . emit_err ( AttributeParseError {
305+ span,
306+ attr_span : self . attr_span ,
307+ template : self . template . clone ( ) ,
308+ attribute : self . attr_path . clone ( ) ,
309+ reason : AttributeParseErrorReason :: ExpectedAtLeastOneArgument ,
310+ } )
311+ }
312+
293313 pub ( crate ) fn expected_specific_argument (
294314 & self ,
295315 span : Span ,
0 commit comments