Skip to content

Commit dfb0c72

Browse files
committed
Make rustc_object_lifetime_default use NoArgsAttributeParser
1 parent 0a8ca9d commit dfb0c72

2 files changed

Lines changed: 3 additions & 13 deletions

File tree

compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -575,21 +575,11 @@ impl<S: Stage> NoArgsAttributeParser<S> for RustcLintUntrackedQueryInformationPa
575575

576576
pub(crate) struct RustcObjectLifetimeDefaultParser;
577577

578-
impl<S: Stage> SingleAttributeParser<S> for RustcObjectLifetimeDefaultParser {
578+
impl<S: Stage> NoArgsAttributeParser<S> for RustcObjectLifetimeDefaultParser {
579579
const PATH: &[Symbol] = &[sym::rustc_object_lifetime_default];
580-
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
581580
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
582581
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Struct)]);
583-
const TEMPLATE: AttributeTemplate = template!(Word);
584-
585-
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {
586-
if let Err(span) = args.no_args() {
587-
cx.expected_no_args(span);
588-
return None;
589-
}
590-
591-
Some(AttributeKind::RustcObjectLifetimeDefault)
592-
}
582+
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcObjectLifetimeDefault;
593583
}
594584

595585
pub(crate) struct RustcSimdMonomorphizeLaneLimitParser;

compiler/rustc_attr_parsing/src/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ attribute_parsers!(
210210
Single<RustcLegacyConstGenericsParser>,
211211
Single<RustcLintOptDenyFieldAccessParser>,
212212
Single<RustcMustImplementOneOfParser>,
213-
Single<RustcObjectLifetimeDefaultParser>,
214213
Single<RustcNeverTypeOptionsParser>,
215214
Single<RustcScalableVectorParser>,
216215
Single<RustcSimdMonomorphizeLaneLimitParser>,
@@ -288,6 +287,7 @@ attribute_parsers!(
288287
Single<WithoutArgs<RustcNoMirInlineParser>>,
289288
Single<WithoutArgs<RustcNonConstTraitMethodParser>>,
290289
Single<WithoutArgs<RustcNounwindParser>>,
290+
Single<WithoutArgs<RustcObjectLifetimeDefaultParser>>,
291291
Single<WithoutArgs<RustcOffloadKernelParser>>,
292292
Single<WithoutArgs<RustcOutlivesParser>>,
293293
Single<WithoutArgs<RustcPassIndirectlyInNonRusticAbisParser>>,

0 commit comments

Comments
 (0)