Skip to content

Commit cb4a7f4

Browse files
fmeaseJonathanBrouwer
authored andcommitted
Rename #[rustc_symbol_name] to #[rustc_dump_symbol_name]
1 parent 0a59706 commit cb4a7f4

42 files changed

Lines changed: 854 additions & 854 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

compiler/rustc_attr_parsing/src/attributes/rustc_dump.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,30 @@ impl<S: Stage> NoArgsAttributeParser<S> for RustcDumpPredicatesParser {
199199
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcDumpPredicates;
200200
}
201201

202+
pub(crate) struct RustcDumpSymbolNameParser;
203+
204+
impl<S: Stage> SingleAttributeParser<S> for RustcDumpSymbolNameParser {
205+
const PATH: &[Symbol] = &[sym::rustc_dump_symbol_name];
206+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
207+
Allow(Target::Fn),
208+
Allow(Target::Method(MethodKind::TraitImpl)),
209+
Allow(Target::Method(MethodKind::Inherent)),
210+
Allow(Target::Method(MethodKind::Trait { body: true })),
211+
Allow(Target::ForeignFn),
212+
Allow(Target::ForeignStatic),
213+
Allow(Target::Impl { of_trait: false }),
214+
]);
215+
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
216+
const TEMPLATE: AttributeTemplate = template!(Word);
217+
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {
218+
if let Err(span) = args.no_args() {
219+
cx.adcx().expected_no_args(span);
220+
return None;
221+
}
222+
Some(AttributeKind::RustcDumpSymbolName(cx.attr_span))
223+
}
224+
}
225+
202226
pub(crate) struct RustcDumpVariancesParser;
203227

204228
impl<S: Stage> NoArgsAttributeParser<S> for RustcDumpVariancesParser {

compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,30 +1143,6 @@ impl<S: Stage> NoArgsAttributeParser<S> for RustcNonnullOptimizationGuaranteedPa
11431143
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcNonnullOptimizationGuaranteed;
11441144
}
11451145

1146-
pub(crate) struct RustcSymbolNameParser;
1147-
1148-
impl<S: Stage> SingleAttributeParser<S> for RustcSymbolNameParser {
1149-
const PATH: &[Symbol] = &[sym::rustc_symbol_name];
1150-
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
1151-
Allow(Target::Fn),
1152-
Allow(Target::Method(MethodKind::TraitImpl)),
1153-
Allow(Target::Method(MethodKind::Inherent)),
1154-
Allow(Target::Method(MethodKind::Trait { body: true })),
1155-
Allow(Target::ForeignFn),
1156-
Allow(Target::ForeignStatic),
1157-
Allow(Target::Impl { of_trait: false }),
1158-
]);
1159-
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
1160-
const TEMPLATE: AttributeTemplate = template!(Word);
1161-
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {
1162-
if let Err(span) = args.no_args() {
1163-
cx.adcx().expected_no_args(span);
1164-
return None;
1165-
}
1166-
Some(AttributeKind::RustcSymbolName(cx.attr_span))
1167-
}
1168-
}
1169-
11701146
pub(crate) struct RustcStrictCoherenceParser;
11711147

11721148
impl<S: Stage> NoArgsAttributeParser<S> for RustcStrictCoherenceParser {

compiler/rustc_attr_parsing/src/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ attribute_parsers!(
216216
Single<RustcDocPrimitiveParser>,
217217
Single<RustcDummyParser>,
218218
Single<RustcDumpDefPathParser>,
219+
Single<RustcDumpSymbolNameParser>,
219220
Single<RustcForceInlineParser>,
220221
Single<RustcIfThisChangedParser>,
221222
Single<RustcLayoutScalarValidRangeEndParser>,
@@ -231,7 +232,6 @@ attribute_parsers!(
231232
Single<RustcScalableVectorParser>,
232233
Single<RustcSimdMonomorphizeLaneLimitParser>,
233234
Single<RustcSkipDuringMethodDispatchParser>,
234-
Single<RustcSymbolNameParser>,
235235
Single<RustcTestMarkerParser>,
236236
Single<SanitizeParser>,
237237
Single<ShouldPanicParser>,

compiler/rustc_feature/src/builtin_attrs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1504,7 +1504,7 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
15041504
EncodeCrossCrate::No
15051505
),
15061506
rustc_attr!(
1507-
TEST, rustc_symbol_name, Normal, template!(Word),
1507+
TEST, rustc_dump_symbol_name, Normal, template!(Word),
15081508
WarnFollowing, EncodeCrossCrate::No
15091509
),
15101510
rustc_attr!(

compiler/rustc_hir/src/attrs/data_structures.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,6 +1389,9 @@ pub enum AttributeKind {
13891389
/// Represents `#[rustc_dump_predicates]`
13901390
RustcDumpPredicates,
13911391

1392+
/// Represents `#[rustc_dump_symbol_name]`
1393+
RustcDumpSymbolName(Span),
1394+
13921395
/// Represents `#[rustc_dump_user_args]`
13931396
RustcDumpUserArgs,
13941397

@@ -1570,9 +1573,6 @@ pub enum AttributeKind {
15701573
/// Represents `#[rustc_strict_coherence]`.
15711574
RustcStrictCoherence(Span),
15721575

1573-
/// Represents `#[rustc_symbol_name]`
1574-
RustcSymbolName(Span),
1575-
15761576
/// Represents `#[rustc_test_marker]`
15771577
RustcTestMarker(Symbol),
15781578

compiler/rustc_hir/src/attrs/encode_cross_crate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ impl AttributeKind {
131131
RustcDumpLayout(..) => No,
132132
RustcDumpObjectLifetimeDefaults => No,
133133
RustcDumpPredicates => No,
134+
RustcDumpSymbolName(..) => Yes,
134135
RustcDumpUserArgs => No,
135136
RustcDumpVariances => No,
136137
RustcDumpVariancesOfOpaques => No,
@@ -183,7 +184,6 @@ impl AttributeKind {
183184
RustcSpecializationTrait(..) => No,
184185
RustcStdInternalSymbol(..) => No,
185186
RustcStrictCoherence(..) => Yes,
186-
RustcSymbolName(..) => Yes,
187187
RustcTestMarker(..) => No,
188188
RustcThenThisWouldNeed(..) => No,
189189
RustcTrivialFieldReads => Yes,

compiler/rustc_interface/src/passes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1273,7 +1273,7 @@ pub(crate) fn start_codegen<'tcx>(
12731273
// Don't run this test assertions when not doing codegen. Compiletest tries to build
12741274
// build-fail tests in check mode first and expects it to not give an error in that case.
12751275
if tcx.sess.opts.output_types.should_codegen() {
1276-
rustc_symbol_mangling::test::report_symbol_names(tcx);
1276+
rustc_symbol_mangling::test::dump_symbol_names_and_def_paths(tcx);
12771277
}
12781278

12791279
// Don't do code generation if there were any errors. Likewise if

compiler/rustc_passes/src/check_attr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
316316
| AttributeKind::RustcDumpItemBounds
317317
| AttributeKind::RustcDumpLayout(..)
318318
| AttributeKind::RustcDumpPredicates
319+
| AttributeKind::RustcDumpSymbolName(..)
319320
| AttributeKind::RustcDumpUserArgs
320321
| AttributeKind::RustcDumpVariances
321322
| AttributeKind::RustcDumpVariancesOfOpaques
@@ -365,7 +366,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
365366
| AttributeKind::RustcSpecializationTrait(..)
366367
| AttributeKind::RustcStdInternalSymbol (..)
367368
| AttributeKind::RustcStrictCoherence(..)
368-
| AttributeKind::RustcSymbolName(..)
369369
| AttributeKind::RustcTestMarker(..)
370370
| AttributeKind::RustcThenThisWouldNeed(..)
371371
| AttributeKind::RustcTrivialFieldReads

compiler/rustc_span/src/symbol.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1727,6 +1727,7 @@ symbols! {
17271727
rustc_dump_layout,
17281728
rustc_dump_object_lifetime_defaults,
17291729
rustc_dump_predicates,
1730+
rustc_dump_symbol_name,
17301731
rustc_dump_user_args,
17311732
rustc_dump_variances,
17321733
rustc_dump_variances_of_opaques,
@@ -1790,7 +1791,6 @@ symbols! {
17901791
rustc_specialization_trait,
17911792
rustc_std_internal_symbol,
17921793
rustc_strict_coherence,
1793-
rustc_symbol_name,
17941794
rustc_test_marker,
17951795
rustc_then_this_would_need,
17961796
rustc_trivial_field_reads,

compiler/rustc_symbol_mangling/src/test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//! Walks the crate looking for items/impl-items/trait-items that have
2-
//! either a `rustc_symbol_name` or `rustc_dump_def_path` attribute and
2+
//! either a `rustc_dump_symbol_name` or `rustc_dump_def_path` attribute and
33
//! generates an error giving, respectively, the symbol name or
44
//! def-path. This is used for unit testing the code that generates
55
//! paths etc in all kinds of annoying scenarios.
@@ -11,7 +11,7 @@ use rustc_middle::ty::{GenericArgs, Instance, TyCtxt};
1111

1212
use crate::errors::{Kind, TestOutput};
1313

14-
pub fn report_symbol_names(tcx: TyCtxt<'_>) {
14+
pub fn dump_symbol_names_and_def_paths(tcx: TyCtxt<'_>) {
1515
// if the `rustc_attrs` feature is not enabled, then the
1616
// attributes we are interested in cannot be present anyway, so
1717
// skip the walk.
@@ -52,7 +52,7 @@ impl SymbolNamesTest<'_> {
5252
// to test the entirety of the string, if they choose, or else just
5353
// some subset.
5454

55-
if let Some(attr_span) = find_attr!(tcx, def_id, RustcSymbolName(span) => span) {
55+
if let Some(attr_span) = find_attr!(tcx, def_id, RustcDumpSymbolName(span) => span) {
5656
let def_id = def_id.to_def_id();
5757
let instance = Instance::new_raw(
5858
def_id,

0 commit comments

Comments
 (0)