@@ -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:: stability:: {
25
26
BodyStabilityParser , ConstStabilityIndirectParser , ConstStabilityParser , StabilityParser ,
26
27
} ;
@@ -112,6 +113,7 @@ attribute_parsers!(
112
113
Single <InlineParser >,
113
114
Single <OptimizeParser >,
114
115
Single <RustcForceInlineParser >,
116
+ Single <SkipDuringMethodDispatchParser >,
115
117
Single <TransparencyParser >,
116
118
// tidy-alphabetical-end
117
119
] ;
@@ -235,14 +237,22 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
235
237
} )
236
238
}
237
239
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
+ }
246
256
}
247
257
248
258
/// 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> {
290
300
} )
291
301
}
292
302
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
+
293
313
pub ( crate ) fn expected_specific_argument (
294
314
& self ,
295
315
span : Span ,
0 commit comments