Skip to content

Commit 77968ca

Browse files
WIP
1 parent 179066e commit 77968ca

17 files changed

+52
-52
lines changed

compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ impl<S: Stage> AttributeParser<S> for UsedParser {
355355
}
356356
},
357357
)];
358-
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Target::Static]);
358+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Static)]);
359359

360360
fn finalize(self, _cx: &FinalizeContext<'_, '_, S>) -> Option<AttributeKind> {
361361
// Ratcheting behaviour, if both `linker` and `compiler` are specified, use `linker`

compiler/rustc_attr_parsing/src/attributes/inline.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl<S: Stage> SingleAttributeParser<S> for RustcForceInlineParser {
6868
const PATH: &'static [Symbol] = &[sym::rustc_force_inline];
6969
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
7070
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError;
71-
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Target::Fn]);
71+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Fn)]);
7272
const TEMPLATE: AttributeTemplate = template!(Word, List: "reason", NameValueStr: "reason");
7373

7474
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser<'_>) -> Option<AttributeKind> {

compiler/rustc_attr_parsing/src/attributes/link_attrs.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ impl<S: Stage> SingleAttributeParser<S> for LinkNameParser {
1818
const PATH: &[Symbol] = &[sym::link_name];
1919
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
2020
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError;
21-
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::ForeignFn), Target::ForeignStatic]);
21+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::ForeignFn), Allow(Target::ForeignStatic)]);
2222
const TEMPLATE: AttributeTemplate = template!(NameValueStr: "name");
2323

2424
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser<'_>) -> Option<AttributeKind> {
@@ -41,7 +41,7 @@ impl<S: Stage> SingleAttributeParser<S> for LinkSectionParser {
4141
const PATH: &[Symbol] = &[sym::link_section];
4242
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
4343
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError;
44-
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Static), Target::Fn]);
44+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Static), Allow(Target::Fn)]);
4545
const TEMPLATE: AttributeTemplate = template!(NameValueStr: "name");
4646

4747
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser<'_>) -> Option<AttributeKind> {
@@ -68,31 +68,31 @@ pub(crate) struct ExportStableParser;
6868
impl<S: Stage> NoArgsAttributeParser<S> for ExportStableParser {
6969
const PATH: &[Symbol] = &[sym::export_stable];
7070
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
71-
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Target::Fn]);
71+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Fn)]);
7272
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::ExportStable;
7373
}
7474

7575
pub(crate) struct FfiConstParser;
7676
impl<S: Stage> NoArgsAttributeParser<S> for FfiConstParser {
7777
const PATH: &[Symbol] = &[sym::ffi_const];
7878
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
79-
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Target::ForeignFn]);
79+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::ForeignFn)]);
8080
const CREATE: fn(Span) -> AttributeKind = AttributeKind::FfiConst;
8181
}
8282

8383
pub(crate) struct FfiPureParser;
8484
impl<S: Stage> NoArgsAttributeParser<S> for FfiPureParser {
8585
const PATH: &[Symbol] = &[sym::ffi_pure];
8686
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
87-
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Target::ForeignFn]);
87+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::ForeignFn)]);
8888
const CREATE: fn(Span) -> AttributeKind = AttributeKind::FfiPure;
8989
}
9090

9191
pub(crate) struct StdInternalSymbolParser;
9292
impl<S: Stage> NoArgsAttributeParser<S> for StdInternalSymbolParser {
9393
const PATH: &[Symbol] = &[sym::rustc_std_internal_symbol];
9494
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
95-
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Fn), Target::ForeignFn]);
95+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Fn), Allow(Target::ForeignFn)]);
9696
const CREATE: fn(Span) -> AttributeKind = AttributeKind::StdInternalSymbol;
9797
}
9898

@@ -102,7 +102,7 @@ impl<S: Stage> SingleAttributeParser<S> for LinkOrdinalParser {
102102
const PATH: &[Symbol] = &[sym::link_ordinal];
103103
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
104104
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
105-
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::ForeignFn), Target::ForeignStatic]);
105+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::ForeignFn), Allow(Target::ForeignStatic)]);
106106
const TEMPLATE: AttributeTemplate = template!(List: "ordinal");
107107

108108
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser<'_>) -> Option<AttributeKind> {

compiler/rustc_attr_parsing/src/attributes/lint_helpers.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ pub(crate) struct PubTransparentParser;
2323
impl<S: Stage> NoArgsAttributeParser<S> for PubTransparentParser {
2424
const PATH: &[Symbol] = &[sym::rustc_pub_transparent];
2525
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
26-
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Struct), Allow(Target::Enum), Target::Union]);
26+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Struct), Allow(Target::Enum), Allow(Target::Union)]);
2727
const CREATE: fn(Span) -> AttributeKind = AttributeKind::PubTransparent;
2828
}
2929

3030
pub(crate) struct PassByValueParser;
3131
impl<S: Stage> NoArgsAttributeParser<S> for PassByValueParser {
3232
const PATH: &[Symbol] = &[sym::rustc_pass_by_value];
3333
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
34-
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Target::Struct]);
34+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Struct)]);
3535
const CREATE: fn(Span) -> AttributeKind = AttributeKind::PassByValue;
3636
}
3737

compiler/rustc_attr_parsing/src/attributes/loop_match.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ pub(crate) struct LoopMatchParser;
1010
impl<S: Stage> NoArgsAttributeParser<S> for LoopMatchParser {
1111
const PATH: &[Symbol] = &[sym::loop_match];
1212
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
13-
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Target::Expression]);
13+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Expression)]);
1414
const CREATE: fn(Span) -> AttributeKind = AttributeKind::LoopMatch;
1515
}
1616

1717
pub(crate) struct ConstContinueParser;
1818
impl<S: Stage> NoArgsAttributeParser<S> for ConstContinueParser {
1919
const PATH: &[Symbol] = &[sym::const_continue];
2020
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
21-
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Target::Expression]);
21+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Expression)]);
2222
const CREATE: fn(Span) -> AttributeKind = AttributeKind::ConstContinue;
2323
}

compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub(crate) struct MacroEscapeParser;
1515
impl<S: Stage> NoArgsAttributeParser<S> for MacroEscapeParser {
1616
const PATH: &[Symbol] = &[sym::macro_escape];
1717
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
18-
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Mod), Target::ExternCrate]);
18+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Mod), Allow(Target::ExternCrate)]);
1919
const CREATE: fn(Span) -> AttributeKind = AttributeKind::MacroEscape;
2020
}
2121

@@ -111,7 +111,7 @@ impl<S: Stage> AttributeParser<S> for MacroUseParser {
111111
}
112112
},
113113
)];
114-
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Mod), Target::ExternCrate]);
114+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Mod), Allow(Target::ExternCrate)]);
115115

116116
fn finalize(self, _cx: &FinalizeContext<'_, '_, S>) -> Option<AttributeKind> {
117117
Some(AttributeKind::MacroUse { span: self.first_span?, arguments: self.state })

compiler/rustc_attr_parsing/src/attributes/no_implicit_prelude.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ pub(crate) struct NoImplicitPreludeParser;
1111
impl<S: Stage> NoArgsAttributeParser<S> for NoImplicitPreludeParser {
1212
const PATH: &[rustc_span::Symbol] = &[sym::no_implicit_prelude];
1313
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
14-
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Target::Crate]);
14+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]);
1515
const CREATE: fn(Span) -> AttributeKind = AttributeKind::NoImplicitPrelude;
1616
}

compiler/rustc_attr_parsing/src/attributes/non_exhaustive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ pub(crate) struct NonExhaustiveParser;
1111
impl<S: Stage> NoArgsAttributeParser<S> for NonExhaustiveParser {
1212
const PATH: &[Symbol] = &[sym::non_exhaustive];
1313
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
14-
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Enum), Allow(Target::Struct), Target::Variant]);
14+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Enum), Allow(Target::Struct), Allow(Target::Variant)]);
1515
const CREATE: fn(Span) -> AttributeKind = AttributeKind::NonExhaustive;
1616
}

compiler/rustc_attr_parsing/src/attributes/path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ impl<S: Stage> SingleAttributeParser<S> for PathParser {
1414
const PATH: &[Symbol] = &[sym::path];
1515
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
1616
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError;
17-
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Target::Mod]);
17+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Mod)]);
1818
const TEMPLATE: AttributeTemplate = template!(NameValueStr: "file");
1919

2020
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser<'_>) -> Option<AttributeKind> {

compiler/rustc_attr_parsing/src/attributes/proc_macro_attrs.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ pub(crate) struct ProcMacroParser;
1515
impl<S: Stage> NoArgsAttributeParser<S> for ProcMacroParser {
1616
const PATH: &[Symbol] = &[sym::proc_macro];
1717
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
18-
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Target::Fn]);
18+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Fn)]);
1919
const CREATE: fn(Span) -> AttributeKind = AttributeKind::ProcMacro;
2020
}
2121

2222
pub(crate) struct ProcMacroAttributeParser;
2323
impl<S: Stage> NoArgsAttributeParser<S> for ProcMacroAttributeParser {
2424
const PATH: &[Symbol] = &[sym::proc_macro_attribute];
2525
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
26-
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Target::Fn]);
26+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Fn)]);
2727
const CREATE: fn(Span) -> AttributeKind = AttributeKind::ProcMacroAttribute;
2828
}
2929

@@ -32,7 +32,7 @@ impl<S: Stage> SingleAttributeParser<S> for ProcMacroDeriveParser {
3232
const PATH: &[Symbol] = &[sym::proc_macro_derive];
3333
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
3434
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
35-
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Target::Fn]);
35+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Fn)]);
3636
const TEMPLATE: AttributeTemplate =
3737
template!(List: "TraitName, /*opt*/ attributes(name1, name2, ...)");
3838

@@ -51,7 +51,7 @@ impl<S: Stage> SingleAttributeParser<S> for RustcBuiltinMacroParser {
5151
const PATH: &[Symbol] = &[sym::rustc_builtin_macro];
5252
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost;
5353
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
54-
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Target::MacroDef]);
54+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::MacroDef)]);
5555
const TEMPLATE: AttributeTemplate =
5656
template!(List: "TraitName, /*opt*/ attributes(name1, name2, ...)");
5757

0 commit comments

Comments
 (0)