@@ -21,6 +21,7 @@ use crate::attributes::deprecation::DeprecationParser;
21
21
use crate :: attributes:: inline:: { InlineParser , RustcForceInlineParser } ;
22
22
use crate :: attributes:: lint_helpers:: AsPtrParser ;
23
23
use crate :: attributes:: repr:: { AlignParser , ReprParser } ;
24
+ use crate :: attributes:: resolution:: SkipDuringMethodDispatchParser ;
24
25
use crate :: attributes:: semantics:: MayDangleParser ;
25
26
use crate :: attributes:: stability:: {
26
27
BodyStabilityParser , ConstStabilityIndirectParser , ConstStabilityParser , StabilityParser ,
@@ -114,6 +115,7 @@ attribute_parsers!(
114
115
Single <MayDangleParser >,
115
116
Single <OptimizeParser >,
116
117
Single <RustcForceInlineParser >,
118
+ Single <SkipDuringMethodDispatchParser >,
117
119
Single <TransparencyParser >,
118
120
// tidy-alphabetical-end
119
121
] ;
@@ -237,14 +239,22 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
237
239
} )
238
240
}
239
241
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
+ }
248
258
}
249
259
250
260
/// 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> {
292
302
} )
293
303
}
294
304
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
+
295
315
pub ( crate ) fn expected_specific_argument (
296
316
& self ,
297
317
span : Span ,
0 commit comments