Skip to content

Commit 0a59706

Browse files
fmeaseJonathanBrouwer
authored andcommitted
Rename #[rustc_def_path] to #[rustc_dump_def_path]
1 parent dda1ea0 commit 0a59706

18 files changed

Lines changed: 58 additions & 58 deletions

File tree

compiler/rustc_attr_parsing/src/attributes/rustc_dump.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,30 @@ impl<S: Stage> NoArgsAttributeParser<S> for RustcDumpDefParentsParser {
2424
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcDumpDefParents;
2525
}
2626

27+
pub(crate) struct RustcDumpDefPathParser;
28+
29+
impl<S: Stage> SingleAttributeParser<S> for RustcDumpDefPathParser {
30+
const PATH: &[Symbol] = &[sym::rustc_dump_def_path];
31+
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
32+
Allow(Target::Fn),
33+
Allow(Target::Method(MethodKind::TraitImpl)),
34+
Allow(Target::Method(MethodKind::Inherent)),
35+
Allow(Target::Method(MethodKind::Trait { body: true })),
36+
Allow(Target::ForeignFn),
37+
Allow(Target::ForeignStatic),
38+
Allow(Target::Impl { of_trait: false }),
39+
]);
40+
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
41+
const TEMPLATE: AttributeTemplate = template!(Word);
42+
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {
43+
if let Err(span) = args.no_args() {
44+
cx.adcx().expected_no_args(span);
45+
return None;
46+
}
47+
Some(AttributeKind::RustcDumpDefPath(cx.attr_span))
48+
}
49+
}
50+
2751
pub(crate) struct RustcDumpHiddenTypeOfOpaquesParser;
2852

2953
impl<S: Stage> NoArgsAttributeParser<S> for RustcDumpHiddenTypeOfOpaquesParser {

compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,30 +1167,6 @@ impl<S: Stage> SingleAttributeParser<S> for RustcSymbolNameParser {
11671167
}
11681168
}
11691169

1170-
pub(crate) struct RustcDefPathParser;
1171-
1172-
impl<S: Stage> SingleAttributeParser<S> for RustcDefPathParser {
1173-
const PATH: &[Symbol] = &[sym::rustc_def_path];
1174-
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
1175-
Allow(Target::Fn),
1176-
Allow(Target::Method(MethodKind::TraitImpl)),
1177-
Allow(Target::Method(MethodKind::Inherent)),
1178-
Allow(Target::Method(MethodKind::Trait { body: true })),
1179-
Allow(Target::ForeignFn),
1180-
Allow(Target::ForeignStatic),
1181-
Allow(Target::Impl { of_trait: false }),
1182-
]);
1183-
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
1184-
const TEMPLATE: AttributeTemplate = template!(Word);
1185-
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {
1186-
if let Err(span) = args.no_args() {
1187-
cx.adcx().expected_no_args(span);
1188-
return None;
1189-
}
1190-
Some(AttributeKind::RustcDefPath(cx.attr_span))
1191-
}
1192-
}
1193-
11941170
pub(crate) struct RustcStrictCoherenceParser;
11951171

11961172
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
@@ -211,11 +211,11 @@ attribute_parsers!(
211211
Single<RustcAllocatorZeroedVariantParser>,
212212
Single<RustcAutodiffParser>,
213213
Single<RustcBuiltinMacroParser>,
214-
Single<RustcDefPathParser>,
215214
Single<RustcDeprecatedSafe2024Parser>,
216215
Single<RustcDiagnosticItemParser>,
217216
Single<RustcDocPrimitiveParser>,
218217
Single<RustcDummyParser>,
218+
Single<RustcDumpDefPathParser>,
219219
Single<RustcForceInlineParser>,
220220
Single<RustcIfThisChangedParser>,
221221
Single<RustcLayoutScalarValidRangeEndParser>,

compiler/rustc_feature/src/builtin_attrs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1508,7 +1508,7 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
15081508
WarnFollowing, EncodeCrossCrate::No
15091509
),
15101510
rustc_attr!(
1511-
TEST, rustc_def_path, Normal, template!(Word),
1511+
TEST, rustc_dump_def_path, Normal, template!(Word),
15121512
WarnFollowing, EncodeCrossCrate::No
15131513
),
15141514
rustc_attr!(

compiler/rustc_hir/src/attrs/data_structures.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,9 +1343,6 @@ pub enum AttributeKind {
13431343
/// Represents `#[rustc_deallocator]`
13441344
RustcDeallocator,
13451345

1346-
/// Represents `#[rustc_def_path]`
1347-
RustcDefPath(Span),
1348-
13491346
/// Represents `#[rustc_delayed_bug_from_inside_query]`
13501347
RustcDelayedBugFromInsideQuery,
13511348

@@ -1371,6 +1368,9 @@ pub enum AttributeKind {
13711368
/// Represents `#[rustc_dump_def_parents]`
13721369
RustcDumpDefParents,
13731370

1371+
/// Represents `#[rustc_dump_def_path]`
1372+
RustcDumpDefPath(Span),
1373+
13741374
/// Represents `#[rustc_dump_hidden_type_of_opaques]`
13751375
RustcDumpHiddenTypeOfOpaques,
13761376

compiler/rustc_hir/src/attrs/encode_cross_crate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ impl AttributeKind {
116116
RustcConstStableIndirect => No,
117117
RustcConversionSuggestion => Yes,
118118
RustcDeallocator => No,
119-
RustcDefPath(..) => No,
120119
RustcDelayedBugFromInsideQuery => No,
121120
RustcDenyExplicitImpl(..) => No,
122121
RustcDeprecatedSafe2024 { .. } => Yes,
@@ -125,6 +124,7 @@ impl AttributeKind {
125124
RustcDocPrimitive(..) => Yes,
126125
RustcDummy => No,
127126
RustcDumpDefParents => No,
127+
RustcDumpDefPath(..) => No,
128128
RustcDumpHiddenTypeOfOpaques => No,
129129
RustcDumpInferredOutlives => No,
130130
RustcDumpItemBounds => No,

compiler/rustc_passes/src/check_attr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
302302
| AttributeKind::RustcConstStableIndirect
303303
| AttributeKind::RustcConversionSuggestion
304304
| AttributeKind::RustcDeallocator
305-
| AttributeKind::RustcDefPath(..)
306305
| AttributeKind::RustcDelayedBugFromInsideQuery
307306
| AttributeKind::RustcDenyExplicitImpl(..)
308307
| AttributeKind::RustcDeprecatedSafe2024 {..}
@@ -311,6 +310,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
311310
| AttributeKind::RustcDocPrimitive(..)
312311
| AttributeKind::RustcDummy
313312
| AttributeKind::RustcDumpDefParents
313+
| AttributeKind::RustcDumpDefPath(..)
314314
| AttributeKind::RustcDumpHiddenTypeOfOpaques
315315
| AttributeKind::RustcDumpInferredOutlives
316316
| AttributeKind::RustcDumpItemBounds

compiler/rustc_span/src/symbol.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1709,7 +1709,6 @@ symbols! {
17091709
rustc_const_unstable,
17101710
rustc_conversion_suggestion,
17111711
rustc_deallocator,
1712-
rustc_def_path,
17131712
rustc_default_body_unstable,
17141713
rustc_delayed_bug_from_inside_query,
17151714
rustc_deny_explicit_impl,
@@ -1721,6 +1720,7 @@ symbols! {
17211720
rustc_driver,
17221721
rustc_dummy,
17231722
rustc_dump_def_parents,
1723+
rustc_dump_def_path,
17241724
rustc_dump_hidden_type_of_opaques,
17251725
rustc_dump_inferred_outlives,
17261726
rustc_dump_item_bounds,

compiler/rustc_symbol_mangling/src/test.rs

Lines changed: 2 additions & 2 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_def_path` attribute and
2+
//! either a `rustc_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.
@@ -80,7 +80,7 @@ impl SymbolNamesTest<'_> {
8080

8181
if let Some(attr_span) = find_attr!(
8282
tcx, def_id,
83-
RustcDefPath(span) => span
83+
RustcDumpDefPath(span) => span
8484
) {
8585
tcx.dcx().emit_err(TestOutput {
8686
span: *attr_span,

src/doc/rustc-dev-guide/src/compiler-debugging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ Here are some notable ones:
273273

274274
| Attribute | Description |
275275
|----------------|-------------|
276-
| `rustc_def_path` | Dumps the [`def_path_str`] of an item. |
277276
| `rustc_dump_def_parents` | Dumps the chain of `DefId` parents of certain definitions. |
277+
| `rustc_dump_def_path` | Dumps the [`def_path_str`] of an item. |
278278
| `rustc_dump_hidden_type_of_opaques` | Dumps the [hidden type of each opaque types][opaq] in the crate. |
279279
| `rustc_dump_inferred_outlives` | Dumps implied bounds of an item. More precisely, the [`inferred_outlives_of`] an item. |
280280
| `rustc_dump_item_bounds` | Dumps the [`item_bounds`] of an item. |

0 commit comments

Comments
 (0)