@@ -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:: semantics:: MayDangleParser ;
2526use crate :: attributes:: stability:: {
2627 BodyStabilityParser , ConstStabilityIndirectParser , ConstStabilityParser , StabilityParser ,
@@ -114,6 +115,7 @@ attribute_parsers!(
114115 Single <MayDangleParser >,
115116 Single <OptimizeParser >,
116117 Single <RustcForceInlineParser >,
118+ Single <SkipDuringMethodDispatchParser >,
117119 Single <TransparencyParser >,
118120 // tidy-alphabetical-end
119121 ] ;
@@ -237,14 +239,22 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
237239 } )
238240 }
239241
240- pub ( crate ) fn expected_no_args ( & self , args_span : Span ) -> ErrorGuaranteed {
241- self . emit_err ( AttributeParseError {
242- span : args_span,
243- attr_span : self . attr_span ,
244- template : self . template . clone ( ) ,
245- attribute : self . attr_path . clone ( ) ,
246- reason : AttributeParseErrorReason :: ExpectedNoArgs ,
247- } )
242+ pub ( crate ) fn expect_no_args ( & self , args : & ArgParser < ' _ > ) -> Result < ( ) , ErrorGuaranteed > {
243+ if let Some ( span) = match args {
244+ ArgParser :: NoArgs => None ,
245+ ArgParser :: List ( args) => Some ( args. span ) ,
246+ ArgParser :: NameValue ( args) => Some ( args. eq_span . to ( args. value_span ) ) ,
247+ } {
248+ Err ( self . emit_err ( AttributeParseError {
249+ span,
250+ attr_span : self . attr_span ,
251+ template : self . template . clone ( ) ,
252+ attribute : self . attr_path . clone ( ) ,
253+ reason : AttributeParseErrorReason :: ExpectedNoArgs ,
254+ } ) )
255+ } else {
256+ Ok ( ( ) )
257+ }
248258 }
249259
250260 /// emit an error that a `name = value` pair was expected at this span. The symbol can be given for
@@ -292,6 +302,16 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
292302 } )
293303 }
294304
305+ pub ( crate ) fn expected_at_least_one_argument ( & self , span : Span ) -> ErrorGuaranteed {
306+ self . emit_err ( AttributeParseError {
307+ span,
308+ attr_span : self . attr_span ,
309+ template : self . template . clone ( ) ,
310+ attribute : self . attr_path . clone ( ) ,
311+ reason : AttributeParseErrorReason :: ExpectedAtLeastOneArgument ,
312+ } )
313+ }
314+
295315 pub ( crate ) fn expected_specific_argument (
296316 & self ,
297317 span : Span ,
0 commit comments