Skip to content

Commit ef5c475

Browse files
committed
Make rustc_object_lifetime_default use NoArgsAttributeParser
1 parent 4755508 commit ef5c475

2 files changed

Lines changed: 14 additions & 27 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: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -169,20 +169,6 @@ attribute_parsers!(
169169
// tidy-alphabetical-end
170170

171171
// tidy-alphabetical-start
172-
%%%%%%% Changes from base to side #1
173-
+ Single<WithoutArgs<RustcStrictCoherenceParser>>,
174-
+++++++ Contents of side #2
175-
Single<WithoutArgs<RustcTrivialFieldReadsParser>>,
176-
<<<<<<< Conflict 1 of 1
177-
>>>>>>> Conflict 1 of 1 ends
178-
Single<WithoutArgs<RustcVarianceOfOpaquesParser>>,
179-
Single<WithoutArgs<RustcVarianceParser>>,
180-
Single<WithoutArgs<SpecializationTraitParser>>,
181-
Single<WithoutArgs<StdInternalSymbolParser>>,
182-
Single<WithoutArgs<ThreadLocalParser>>,
183-
Single<WithoutArgs<TrackCallerParser>>,
184-
Single<WithoutArgs<TypeConstParser>>,
185-
Single<WithoutArgs<UnsafeSpecializationMarkerParser>>,
186172
Single<CfiEncodingParser>,
187173
Single<CollapseDebugInfoParser>,
188174
Single<CoverageParser>,
@@ -225,7 +211,7 @@ attribute_parsers!(
225211
Single<RustcLintOptDenyFieldAccessParser>,
226212
Single<RustcMustImplementOneOfParser>,
227213
Single<RustcNeverTypeOptionsParser>,
228-
Single<RustcObjectLifetimeDefaultParser>,
214+
Single<RustcNeverTypeOptionsParser>,
229215
Single<RustcScalableVectorParser>,
230216
Single<RustcSimdMonomorphizeLaneLimitParser>,
231217
Single<RustcSymbolName>,
@@ -303,13 +289,24 @@ attribute_parsers!(
303289
Single<WithoutArgs<RustcNoMirInlineParser>>,
304290
Single<WithoutArgs<RustcNonConstTraitMethodParser>>,
305291
Single<WithoutArgs<RustcNounwindParser>>,
292+
Single<WithoutArgs<RustcObjectLifetimeDefaultParser>>,
306293
Single<WithoutArgs<RustcOffloadKernelParser>>,
307294
Single<WithoutArgs<RustcOutlivesParser>>,
308295
Single<WithoutArgs<RustcPassIndirectlyInNonRusticAbisParser>>,
309296
Single<WithoutArgs<RustcPreserveUbChecksParser>>,
310297
Single<WithoutArgs<RustcReallocatorParser>>,
311298
Single<WithoutArgs<RustcRegionsParser>>,
312299
Single<WithoutArgs<RustcShouldNotBeCalledOnConstItems>>,
300+
Single<WithoutArgs<RustcStrictCoherenceParser>>,
301+
Single<WithoutArgs<RustcTrivialFieldReadsParser>>,
302+
Single<WithoutArgs<RustcVarianceOfOpaquesParser>>,
303+
Single<WithoutArgs<RustcVarianceParser>>,
304+
Single<WithoutArgs<SpecializationTraitParser>>,
305+
Single<WithoutArgs<StdInternalSymbolParser>>,
306+
Single<WithoutArgs<ThreadLocalParser>>,
307+
Single<WithoutArgs<TrackCallerParser>>,
308+
Single<WithoutArgs<TypeConstParser>>,
309+
Single<WithoutArgs<UnsafeSpecializationMarkerParser>>,
313310
// tidy-alphabetical-end
314311
];
315312
);

0 commit comments

Comments
 (0)