Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions compiler/rustc_attr_parsing/src/attributes/allow_unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ impl CombineAttributeParser for AllowInternalUnstableParser {
type Item = (Symbol, Span);
const CONVERT: ConvertFn<Self::Item> =
|items, span| AttributeKind::AllowInternalUnstable(items, span);
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[
Allow(Target::MacroDef),
Allow(Target::Fn),
Warn(Target::Field),
Expand All @@ -36,7 +36,7 @@ impl CombineAttributeParser for UnstableFeatureBoundParser {
type Item = (Symbol, Span);
const CONVERT: ConvertFn<Self::Item> = |items, _| AttributeKind::UnstableFeatureBound(items);
const STABILITY: AttributeStability = unstable!(staged_api);
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[
Allow(Target::Fn),
Allow(Target::Impl { of_trait: true }),
Allow(Target::Trait),
Expand All @@ -59,7 +59,7 @@ impl CombineAttributeParser for RustcAllowConstFnUnstableParser {
type Item = Symbol;
const CONVERT: ConvertFn<Self::Item> =
|items, first_span| AttributeKind::RustcAllowConstFnUnstable(items, first_span);
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[
Allow(Target::Fn),
Allow(Target::Method(MethodKind::Inherent)),
Allow(Target::Method(MethodKind::Trait { body: true })),
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/src/attributes/autodiff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub(crate) struct RustcAutodiffParser;

impl SingleAttributeParser for RustcAutodiffParser {
const PATH: &[Symbol] = &[sym::rustc_autodiff];
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[
Allow(Target::Fn),
Allow(Target::Method(MethodKind::Inherent)),
Allow(Target::Method(MethodKind::Trait { body: true })),
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_attr_parsing/src/attributes/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ pub(crate) struct CoroutineParser;

impl NoArgsAttributeParser for CoroutineParser {
const PATH: &[Symbol] = &[sym::coroutine];
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Closure)]);
const ALLOWED_TARGETS: AllowedTargets<'_> =
AllowedTargets::AllowList(&[Allow(Target::Closure)]);
const STABILITY: AttributeStability = unstable!(coroutines);
const CREATE: fn(rustc_span::Span) -> AttributeKind = |_| AttributeKind::Coroutine;
}
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/src/attributes/cfi_encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use super::prelude::*;
pub(crate) struct CfiEncodingParser;
impl SingleAttributeParser for CfiEncodingParser {
const PATH: &[Symbol] = &[sym::cfi_encoding];
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowListWarnRest(&[
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowListWarnRest(&[
Allow(Target::Struct),
Allow(Target::ForeignTy),
Allow(Target::Enum),
Expand Down
36 changes: 18 additions & 18 deletions compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub(crate) struct OptimizeParser;

impl SingleAttributeParser for OptimizeParser {
const PATH: &[Symbol] = &[sym::optimize];
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[
Allow(Target::Fn),
Allow(Target::Closure),
Allow(Target::Method(MethodKind::Trait { body: true })),
Expand Down Expand Up @@ -51,7 +51,7 @@ pub(crate) struct ColdParser;
impl NoArgsAttributeParser for ColdParser {
const PATH: &[Symbol] = &[sym::cold];
const ON_DUPLICATE: OnDuplicate = OnDuplicate::Warn;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowListWarnRest(&[
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowListWarnRest(&[
Allow(Target::Fn),
Allow(Target::Method(MethodKind::Trait { body: true })),
Allow(Target::Method(MethodKind::TraitImpl)),
Expand All @@ -67,7 +67,7 @@ pub(crate) struct CoverageParser;

impl SingleAttributeParser for CoverageParser {
const PATH: &[Symbol] = &[sym::coverage];
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[
Allow(Target::Fn),
Allow(Target::Closure),
Allow(Target::Method(MethodKind::Trait { body: true })),
Expand Down Expand Up @@ -114,7 +114,7 @@ impl SingleAttributeParser for ExportNameParser {
note: "the linker's behavior with multiple libraries exporting duplicate symbol names is undefined and Rust cannot provide guarantees when you manually override them",
unsafe_since: Some(Edition2024),
};
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[
Allow(Target::Static),
Allow(Target::Fn),
Allow(Target::Method(MethodKind::Inherent)),
Expand Down Expand Up @@ -151,7 +151,7 @@ pub(crate) struct RustcObjcClassParser;

impl SingleAttributeParser for RustcObjcClassParser {
const PATH: &[rustc_span::Symbol] = &[sym::rustc_objc_class];
const ALLOWED_TARGETS: AllowedTargets =
const ALLOWED_TARGETS: AllowedTargets<'_> =
AllowedTargets::AllowList(&[Allow(Target::ForeignStatic)]);
const TEMPLATE: AttributeTemplate = template!(NameValueStr: "ClassName");
const STABILITY: AttributeStability = unstable!(rustc_attrs);
Expand Down Expand Up @@ -179,7 +179,7 @@ pub(crate) struct RustcObjcSelectorParser;

impl SingleAttributeParser for RustcObjcSelectorParser {
const PATH: &[rustc_span::Symbol] = &[sym::rustc_objc_selector];
const ALLOWED_TARGETS: AllowedTargets =
const ALLOWED_TARGETS: AllowedTargets<'_> =
AllowedTargets::AllowList(&[Allow(Target::ForeignStatic)]);
const TEMPLATE: AttributeTemplate = template!(NameValueStr: "methodName");
const STABILITY: AttributeStability = unstable!(rustc_attrs);
Expand Down Expand Up @@ -226,7 +226,7 @@ impl AttributeParser for NakedParser {
note: "the `#[naked]` attribute adds the safety obligation that the function's body must respect the function’s calling convention, uphold its signature, and either return or diverge (i.e., not fall through past the end of the assembly code).",
unsafe_since: None,
};
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[
Allow(Target::Fn),
Allow(Target::Method(MethodKind::Inherent)),
Allow(Target::Method(MethodKind::Trait { body: true })),
Expand Down Expand Up @@ -334,7 +334,7 @@ pub(crate) struct TrackCallerParser;
impl NoArgsAttributeParser for TrackCallerParser {
const PATH: &[Symbol] = &[sym::track_caller];
const ON_DUPLICATE: OnDuplicate = OnDuplicate::Warn;
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[
Allow(Target::Fn),
Allow(Target::Method(MethodKind::Inherent)),
Allow(Target::Method(MethodKind::Trait { body: true })),
Expand All @@ -359,7 +359,7 @@ impl NoArgsAttributeParser for NoMangleParser {
note: "the linker's behavior with multiple libraries exporting duplicate symbol names is undefined and Rust cannot provide guarantees when you manually override them",
unsafe_since: Some(Edition2024),
};
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowListWarnRest(&[
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowListWarnRest(&[
Allow(Target::Fn),
Allow(Target::Static),
Allow(Target::Method(MethodKind::Inherent)),
Expand Down Expand Up @@ -462,7 +462,7 @@ impl AttributeParser for UsedParser {
}
},
)];
const ALLOWED_TARGETS: AllowedTargets =
const ALLOWED_TARGETS: AllowedTargets<'_> =
AllowedTargets::AllowList(&[Allow(Target::Static), Warn(Target::MacroCall)]);

fn finalize(self, _cx: &FinalizeContext<'_, '_>) -> Option<AttributeKind> {
Expand Down Expand Up @@ -533,7 +533,7 @@ impl CombineAttributeParser for TargetFeatureParser {
parse_tf_attribute(cx, args)
}

const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[
Allow(Target::Fn),
Allow(Target::Method(MethodKind::Inherent)),
Allow(Target::Method(MethodKind::Trait { body: true })),
Expand Down Expand Up @@ -561,7 +561,7 @@ impl CombineAttributeParser for ForceTargetFeatureParser {
was_forced: true,
};
const TEMPLATE: AttributeTemplate = template!(List: &["enable = \"feat1, feat2\""]);
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[
Allow(Target::Fn),
Allow(Target::Method(MethodKind::Inherent)),
Allow(Target::Method(MethodKind::Trait { body: true })),
Expand All @@ -581,7 +581,7 @@ pub(crate) struct InstrumentFnParser;

impl SingleAttributeParser for InstrumentFnParser {
const PATH: &[Symbol] = &[sym::instrument_fn];
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[
Allow(Target::Fn),
Allow(Target::Method(MethodKind::Inherent)),
Allow(Target::Method(MethodKind::Trait { body: true })),
Expand Down Expand Up @@ -619,7 +619,7 @@ pub(crate) struct SanitizeParser;

impl SingleAttributeParser for SanitizeParser {
const PATH: &[Symbol] = &[sym::sanitize];
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[
Allow(Target::Fn),
Allow(Target::Closure),
Allow(Target::Method(MethodKind::Inherent)),
Expand Down Expand Up @@ -751,7 +751,7 @@ pub(crate) struct ThreadLocalParser;

impl NoArgsAttributeParser for ThreadLocalParser {
const PATH: &[Symbol] = &[sym::thread_local];
const ALLOWED_TARGETS: AllowedTargets =
const ALLOWED_TARGETS: AllowedTargets<'_> =
AllowedTargets::AllowList(&[Allow(Target::Static), Allow(Target::ForeignStatic)]);
const STABILITY: AttributeStability = unstable!(thread_local);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::ThreadLocal;
Expand All @@ -761,7 +761,7 @@ pub(crate) struct RustcPassIndirectlyInNonRusticAbisParser;

impl NoArgsAttributeParser for RustcPassIndirectlyInNonRusticAbisParser {
const PATH: &[Symbol] = &[sym::rustc_pass_indirectly_in_non_rustic_abis];
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Struct)]);
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[Allow(Target::Struct)]);
const STABILITY: AttributeStability = unstable!(rustc_attrs);
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcPassIndirectlyInNonRusticAbis;
}
Expand All @@ -770,7 +770,7 @@ pub(crate) struct RustcEiiForeignItemParser;

impl NoArgsAttributeParser for RustcEiiForeignItemParser {
const PATH: &[Symbol] = &[sym::rustc_eii_foreign_item];
const ALLOWED_TARGETS: AllowedTargets =
const ALLOWED_TARGETS: AllowedTargets<'_> =
AllowedTargets::AllowList(&[Allow(Target::ForeignFn), Allow(Target::ForeignStatic)]);
const STABILITY: AttributeStability = unstable!(eii_internals);
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcEiiForeignItem;
Expand All @@ -780,7 +780,7 @@ pub(crate) struct PatchableFunctionEntryParser;

impl SingleAttributeParser for PatchableFunctionEntryParser {
const PATH: &[Symbol] = &[sym::patchable_function_entry];
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Fn)]);
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[Allow(Target::Fn)]);
const TEMPLATE: AttributeTemplate = template!(List: &["prefix_nops = m, entry_nops = n"]);
const STABILITY: AttributeStability = unstable!(patchable_function_entry);

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/src/attributes/confusables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl AttributeParser for ConfusablesParser {
this.first_span.get_or_insert(cx.attr_span);
},
)];
const ALLOWED_TARGETS: AllowedTargets =
const ALLOWED_TARGETS: AllowedTargets<'_> =
AllowedTargets::AllowList(&[Allow(Target::Method(MethodKind::Inherent))]);

fn finalize(self, _cx: &FinalizeContext<'_, '_>) -> Option<AttributeKind> {
Expand Down
Loading
Loading