Skip to content

Commit 02bd3e8

Browse files
committed
Use Rustc prefix for rustc attrs in AttributeKind
1 parent 80b8982 commit 02bd3e8

25 files changed

Lines changed: 187 additions & 176 deletions

File tree

compiler/rustc_attr_parsing/src/attributes/allow_unstable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl<S: Stage> CombineAttributeParser<S> for AllowConstFnUnstableParser {
5757
const PATH: &[Symbol] = &[sym::rustc_allow_const_fn_unstable];
5858
type Item = Symbol;
5959
const CONVERT: ConvertFn<Self::Item> =
60-
|items, first_span| AttributeKind::AllowConstFnUnstable(items, first_span);
60+
|items, first_span| AttributeKind::RustcAllowConstFnUnstable(items, first_span);
6161
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
6262
Allow(Target::Fn),
6363
Allow(Target::Method(MethodKind::Inherent)),

compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ impl<S: Stage> SingleAttributeParser<S> for ObjcClassParser {
181181
cx.emit_err(NullOnObjcClass { span: nv.value_span });
182182
return None;
183183
}
184-
Some(AttributeKind::ObjcClass { classname, span: cx.attr_span })
184+
Some(AttributeKind::RustcObjcClass { classname, span: cx.attr_span })
185185
}
186186
}
187187

@@ -213,7 +213,7 @@ impl<S: Stage> SingleAttributeParser<S> for ObjcSelectorParser {
213213
cx.emit_err(NullOnObjcSelector { span: nv.value_span });
214214
return None;
215215
}
216-
Some(AttributeKind::ObjcSelector { methname, span: cx.attr_span })
216+
Some(AttributeKind::RustcObjcSelector { methname, span: cx.attr_span })
217217
}
218218
}
219219

compiler/rustc_attr_parsing/src/attributes/confusables.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl<S: Stage> AttributeParser<S> for ConfusablesParser {
4343
return None;
4444
}
4545

46-
Some(AttributeKind::Confusables {
46+
Some(AttributeKind::RustcConfusables {
4747
symbols: self.confusables,
4848
first_span: self.first_span.unwrap(),
4949
})

compiler/rustc_attr_parsing/src/attributes/dummy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ impl<S: Stage> SingleAttributeParser<S> for DummyParser {
1616
const TEMPLATE: AttributeTemplate = template!(Word); // Anything, really
1717

1818
fn convert(_: &mut AcceptContext<'_, '_, S>, _: &ArgParser) -> Option<AttributeKind> {
19-
Some(AttributeKind::Dummy)
19+
Some(AttributeKind::RustcDummy)
2020
}
2121
}

compiler/rustc_attr_parsing/src/attributes/link_attrs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ impl<S: Stage> NoArgsAttributeParser<S> for StdInternalSymbolParser {
529529
Allow(Target::Static),
530530
Allow(Target::ForeignStatic),
531531
]);
532-
const CREATE: fn(Span) -> AttributeKind = AttributeKind::StdInternalSymbol;
532+
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcStdInternalSymbol;
533533
}
534534

535535
pub(crate) struct LinkOrdinalParser;

compiler/rustc_attr_parsing/src/attributes/lint_helpers.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ impl<S: Stage> NoArgsAttributeParser<S> for AsPtrParser {
1111
Allow(Target::Method(MethodKind::Trait { body: true })),
1212
Allow(Target::Method(MethodKind::TraitImpl)),
1313
]);
14-
const CREATE: fn(Span) -> AttributeKind = AttributeKind::AsPtr;
14+
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcAsPtr;
1515
}
1616

1717
pub(crate) struct PubTransparentParser;
@@ -23,7 +23,7 @@ impl<S: Stage> NoArgsAttributeParser<S> for PubTransparentParser {
2323
Allow(Target::Enum),
2424
Allow(Target::Union),
2525
]);
26-
const CREATE: fn(Span) -> AttributeKind = AttributeKind::PubTransparent;
26+
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcPubTransparent;
2727
}
2828

2929
pub(crate) struct PassByValueParser;
@@ -35,7 +35,7 @@ impl<S: Stage> NoArgsAttributeParser<S> for PassByValueParser {
3535
Allow(Target::Enum),
3636
Allow(Target::TyAlias),
3737
]);
38-
const CREATE: fn(Span) -> AttributeKind = AttributeKind::PassByValue;
38+
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcPassByValue;
3939
}
4040

4141
pub(crate) struct RustcShouldNotBeCalledOnConstItems;

compiler/rustc_attr_parsing/src/attributes/stability.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ impl<S: Stage> AttributeParser<S> for BodyStabilityParser {
173173
fn finalize(self, _cx: &FinalizeContext<'_, '_, S>) -> Option<AttributeKind> {
174174
let (stability, span) = self.stability?;
175175

176-
Some(AttributeKind::BodyStability { stability, span })
176+
Some(AttributeKind::RustcBodyStability { stability, span })
177177
}
178178
}
179179

@@ -185,7 +185,7 @@ impl<S: Stage> NoArgsAttributeParser<S> for ConstStabilityIndirectParser {
185185
Allow(Target::Fn),
186186
Allow(Target::Method(MethodKind::Inherent)),
187187
]);
188-
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::ConstStabilityIndirect;
188+
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcConstStabilityIndirect;
189189
}
190190

191191
#[derive(Default)]
@@ -258,7 +258,7 @@ impl<S: Stage> AttributeParser<S> for ConstStabilityParser {
258258

259259
let (stability, span) = self.stability?;
260260

261-
Some(AttributeKind::ConstStability { stability, span })
261+
Some(AttributeKind::RustcConstStability { stability, span })
262262
}
263263
}
264264

compiler/rustc_attr_parsing/src/attributes/traits.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ impl<S: Stage> SingleAttributeParser<S> for SkipDuringMethodDispatchParser {
5050
cx.duplicate_key(arg.span(), key);
5151
}
5252
}
53-
Some(AttributeKind::SkipDuringMethodDispatch { array, boxed_slice, span: cx.attr_span })
53+
Some(AttributeKind::RustcSkipDuringMethodDispatch {
54+
array,
55+
boxed_slice,
56+
span: cx.attr_span,
57+
})
5458
}
5559
}
5660

@@ -59,7 +63,7 @@ impl<S: Stage> NoArgsAttributeParser<S> for ParenSugarParser {
5963
const PATH: &[Symbol] = &[sym::rustc_paren_sugar];
6064
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
6165
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Trait)]);
62-
const CREATE: fn(Span) -> AttributeKind = AttributeKind::ParenSugar;
66+
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcParenSugar;
6367
}
6468

6569
pub(crate) struct TypeConstParser;
@@ -91,15 +95,15 @@ impl<S: Stage> NoArgsAttributeParser<S> for DenyExplicitImplParser {
9195
const PATH: &[Symbol] = &[sym::rustc_deny_explicit_impl];
9296
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
9397
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Trait)]);
94-
const CREATE: fn(Span) -> AttributeKind = AttributeKind::DenyExplicitImpl;
98+
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcDenyExplicitImpl;
9599
}
96100

97101
pub(crate) struct DynIncompatibleTraitParser;
98102
impl<S: Stage> NoArgsAttributeParser<S> for DynIncompatibleTraitParser {
99103
const PATH: &[Symbol] = &[sym::rustc_dyn_incompatible_trait];
100104
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
101105
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Trait)]);
102-
const CREATE: fn(Span) -> AttributeKind = AttributeKind::DynIncompatibleTrait;
106+
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcDynIncompatibleTrait;
103107
}
104108

105109
// Specialization
@@ -109,15 +113,15 @@ impl<S: Stage> NoArgsAttributeParser<S> for SpecializationTraitParser {
109113
const PATH: &[Symbol] = &[sym::rustc_specialization_trait];
110114
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
111115
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Trait)]);
112-
const CREATE: fn(Span) -> AttributeKind = AttributeKind::SpecializationTrait;
116+
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcSpecializationTrait;
113117
}
114118

115119
pub(crate) struct UnsafeSpecializationMarkerParser;
116120
impl<S: Stage> NoArgsAttributeParser<S> for UnsafeSpecializationMarkerParser {
117121
const PATH: &[Symbol] = &[sym::rustc_unsafe_specialization_marker];
118122
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
119123
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Trait)]);
120-
const CREATE: fn(Span) -> AttributeKind = AttributeKind::UnsafeSpecializationMarker;
124+
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcUnsafeSpecializationMarker;
121125
}
122126

123127
// Coherence
@@ -127,7 +131,7 @@ impl<S: Stage> NoArgsAttributeParser<S> for CoinductiveParser {
127131
const PATH: &[Symbol] = &[sym::rustc_coinductive];
128132
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
129133
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Trait)]);
130-
const CREATE: fn(Span) -> AttributeKind = AttributeKind::Coinductive;
134+
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcCoinductive;
131135
}
132136

133137
pub(crate) struct AllowIncoherentImplParser;
@@ -136,7 +140,7 @@ impl<S: Stage> NoArgsAttributeParser<S> for AllowIncoherentImplParser {
136140
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
137141
const ALLOWED_TARGETS: AllowedTargets =
138142
AllowedTargets::AllowList(&[Allow(Target::Method(MethodKind::Inherent))]);
139-
const CREATE: fn(Span) -> AttributeKind = AttributeKind::AllowIncoherentImpl;
143+
const CREATE: fn(Span) -> AttributeKind = AttributeKind::RustcAllowIncoherentImpl;
140144
}
141145

142146
pub(crate) struct FundamentalParser;

compiler/rustc_attr_parsing/src/attributes/transparency.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ impl<S: Stage> SingleAttributeParser<S> for TransparencyParser {
3232
}
3333
None => None,
3434
}
35-
.map(AttributeKind::MacroTransparency)
35+
.map(AttributeKind::RustcMacroTransparency)
3636
}
3737
}

compiler/rustc_codegen_ssa/src/codegen_attrs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ fn process_builtin_attrs(
189189
},
190190
AttributeKind::FfiConst(_) => codegen_fn_attrs.flags |= CodegenFnAttrFlags::FFI_CONST,
191191
AttributeKind::FfiPure(_) => codegen_fn_attrs.flags |= CodegenFnAttrFlags::FFI_PURE,
192-
AttributeKind::StdInternalSymbol(_) => {
192+
AttributeKind::RustcStdInternalSymbol(_) => {
193193
codegen_fn_attrs.flags |= CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL
194194
}
195195
AttributeKind::Linkage(linkage, span) => {
@@ -217,10 +217,10 @@ fn process_builtin_attrs(
217217
AttributeKind::Sanitize { span, .. } => {
218218
interesting_spans.sanitize = Some(*span);
219219
}
220-
AttributeKind::ObjcClass { classname, .. } => {
220+
AttributeKind::RustcObjcClass { classname, .. } => {
221221
codegen_fn_attrs.objc_class = Some(*classname);
222222
}
223-
AttributeKind::ObjcSelector { methname, .. } => {
223+
AttributeKind::RustcObjcSelector { methname, .. } => {
224224
codegen_fn_attrs.objc_selector = Some(*methname);
225225
}
226226
AttributeKind::EiiForeignItem => {

0 commit comments

Comments
 (0)