From dda1ea0c43ce518d9445b9b3b6773e6fa80712db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=C3=B3n=20Orell=20Valerian=20Liehr?= Date: Thu, 9 Apr 2026 05:21:17 +0200 Subject: [PATCH] Rename `#[rustc_hidden_type_of_opaques]` to `#[rustc_dump_hidden_type_of_opaques]` --- compiler/rustc_attr_parsing/src/attributes/rustc_dump.rs | 9 +++++++++ .../rustc_attr_parsing/src/attributes/rustc_internal.rs | 8 -------- compiler/rustc_attr_parsing/src/context.rs | 2 +- compiler/rustc_feature/src/builtin_attrs.rs | 2 +- compiler/rustc_hir/src/attrs/data_structures.rs | 6 +++--- compiler/rustc_hir/src/attrs/encode_cross_crate.rs | 2 +- compiler/rustc_hir_analysis/src/collect/dump.rs | 2 +- compiler/rustc_passes/src/check_attr.rs | 2 +- compiler/rustc_span/src/symbol.rs | 2 +- src/doc/rustc-dev-guide/src/compiler-debugging.md | 2 +- tests/ui/impl-trait/erased-regions-in-hidden-ty.rs | 2 +- tests/ui/impl-trait/in-trait/dump.rs | 2 +- 12 files changed, 21 insertions(+), 20 deletions(-) diff --git a/compiler/rustc_attr_parsing/src/attributes/rustc_dump.rs b/compiler/rustc_attr_parsing/src/attributes/rustc_dump.rs index 7ee908ea0807..bc01f0a9db47 100644 --- a/compiler/rustc_attr_parsing/src/attributes/rustc_dump.rs +++ b/compiler/rustc_attr_parsing/src/attributes/rustc_dump.rs @@ -24,6 +24,15 @@ impl NoArgsAttributeParser for RustcDumpDefParentsParser { const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcDumpDefParents; } +pub(crate) struct RustcDumpHiddenTypeOfOpaquesParser; + +impl NoArgsAttributeParser for RustcDumpHiddenTypeOfOpaquesParser { + const PATH: &[Symbol] = &[sym::rustc_dump_hidden_type_of_opaques]; + const ON_DUPLICATE: OnDuplicate = OnDuplicate::Error; + const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]); + const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcDumpHiddenTypeOfOpaques; +} + pub(crate) struct RustcDumpInferredOutlivesParser; impl NoArgsAttributeParser for RustcDumpInferredOutlivesParser { diff --git a/compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs b/compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs index e609af8caaa7..c155468d748e 100644 --- a/compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs +++ b/compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs @@ -680,14 +680,6 @@ impl NoArgsAttributeParser for PanicHandlerParser { const CREATE: fn(Span) -> AttributeKind = |span| AttributeKind::Lang(LangItem::PanicImpl, span); } -pub(crate) struct RustcHiddenTypeOfOpaquesParser; - -impl NoArgsAttributeParser for RustcHiddenTypeOfOpaquesParser { - const PATH: &[Symbol] = &[sym::rustc_hidden_type_of_opaques]; - const ON_DUPLICATE: OnDuplicate = OnDuplicate::Error; - const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Crate)]); - const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcHiddenTypeOfOpaques; -} pub(crate) struct RustcNounwindParser; impl NoArgsAttributeParser for RustcNounwindParser { diff --git a/compiler/rustc_attr_parsing/src/context.rs b/compiler/rustc_attr_parsing/src/context.rs index dd15a7b25fcb..395b23a24b26 100644 --- a/compiler/rustc_attr_parsing/src/context.rs +++ b/compiler/rustc_attr_parsing/src/context.rs @@ -285,6 +285,7 @@ mod late { Single>, Single>, Single>, + Single>, Single>, Single>, Single>, @@ -298,7 +299,6 @@ mod late { Single>, Single>, Single>, - Single>, Single>, Single>, Single>, diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index 22e5fe77f890..daeac9fd47ad 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -1449,7 +1449,7 @@ pub struct BuiltinAttribute { WarnFollowing, EncodeCrossCrate::No ), rustc_attr!( - TEST, rustc_hidden_type_of_opaques, Normal, template!(Word), + TEST, rustc_dump_hidden_type_of_opaques, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No ), rustc_attr!( diff --git a/compiler/rustc_hir/src/attrs/data_structures.rs b/compiler/rustc_hir/src/attrs/data_structures.rs index eaf741784f4b..752055fc7d14 100644 --- a/compiler/rustc_hir/src/attrs/data_structures.rs +++ b/compiler/rustc_hir/src/attrs/data_structures.rs @@ -1371,6 +1371,9 @@ pub enum AttributeKind { /// Represents `#[rustc_dump_def_parents]` RustcDumpDefParents, + /// Represents `#[rustc_dump_hidden_type_of_opaques]` + RustcDumpHiddenTypeOfOpaques, + /// Represents `#[rustc_dump_inferred_outlives]` RustcDumpInferredOutlives, @@ -1412,9 +1415,6 @@ pub enum AttributeKind { RustcHasIncoherentInherentImpls, - /// Represents `#[rustc_hidden_type_of_opaques]` - RustcHiddenTypeOfOpaques, - /// Represents `#[rustc_if_this_changed]` RustcIfThisChanged(Span, Option), diff --git a/compiler/rustc_hir/src/attrs/encode_cross_crate.rs b/compiler/rustc_hir/src/attrs/encode_cross_crate.rs index ae78060711bf..d70179298d2e 100644 --- a/compiler/rustc_hir/src/attrs/encode_cross_crate.rs +++ b/compiler/rustc_hir/src/attrs/encode_cross_crate.rs @@ -125,6 +125,7 @@ pub fn encode_cross_crate(&self) -> EncodeCrossCrate { RustcDocPrimitive(..) => Yes, RustcDummy => No, RustcDumpDefParents => No, + RustcDumpHiddenTypeOfOpaques => No, RustcDumpInferredOutlives => No, RustcDumpItemBounds => No, RustcDumpLayout(..) => No, @@ -139,7 +140,6 @@ pub fn encode_cross_crate(&self) -> EncodeCrossCrate { RustcEiiForeignItem => No, RustcEvaluateWhereClauses => Yes, RustcHasIncoherentInherentImpls => Yes, - RustcHiddenTypeOfOpaques => No, RustcIfThisChanged(..) => No, RustcInheritOverflowChecks => No, RustcInsignificantDtor => Yes, diff --git a/compiler/rustc_hir_analysis/src/collect/dump.rs b/compiler/rustc_hir_analysis/src/collect/dump.rs index 3e9c83b12df0..f1bb90fcbe89 100644 --- a/compiler/rustc_hir_analysis/src/collect/dump.rs +++ b/compiler/rustc_hir_analysis/src/collect/dump.rs @@ -7,7 +7,7 @@ use rustc_span::sym; pub(crate) fn opaque_hidden_types(tcx: TyCtxt<'_>) { - if !find_attr!(tcx, crate, RustcHiddenTypeOfOpaques) { + if !find_attr!(tcx, crate, RustcDumpHiddenTypeOfOpaques) { return; } for id in tcx.hir_crate_items(()).opaques() { diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index b4a3e4a92553..444ac5371d1c 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -311,6 +311,7 @@ fn check_attributes( | AttributeKind::RustcDocPrimitive(..) | AttributeKind::RustcDummy | AttributeKind::RustcDumpDefParents + | AttributeKind::RustcDumpHiddenTypeOfOpaques | AttributeKind::RustcDumpInferredOutlives | AttributeKind::RustcDumpItemBounds | AttributeKind::RustcDumpLayout(..) @@ -324,7 +325,6 @@ fn check_attributes( | AttributeKind::RustcEiiForeignItem | AttributeKind::RustcEvaluateWhereClauses | AttributeKind::RustcHasIncoherentInherentImpls - | AttributeKind::RustcHiddenTypeOfOpaques | AttributeKind::RustcIfThisChanged(..) | AttributeKind::RustcInheritOverflowChecks | AttributeKind::RustcInsignificantDtor diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index ba41bfaa1a14..54f55ab86691 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -1721,6 +1721,7 @@ rustc_driver, rustc_dummy, rustc_dump_def_parents, + rustc_dump_hidden_type_of_opaques, rustc_dump_inferred_outlives, rustc_dump_item_bounds, rustc_dump_layout, @@ -1737,7 +1738,6 @@ rustc_expected_cgu_reuse, rustc_force_inline, rustc_has_incoherent_inherent_impls, - rustc_hidden_type_of_opaques, rustc_if_this_changed, rustc_inherit_overflow_checks, rustc_insignificant_dtor, diff --git a/src/doc/rustc-dev-guide/src/compiler-debugging.md b/src/doc/rustc-dev-guide/src/compiler-debugging.md index ef00bbfdb8e5..ef808a3736ad 100644 --- a/src/doc/rustc-dev-guide/src/compiler-debugging.md +++ b/src/doc/rustc-dev-guide/src/compiler-debugging.md @@ -275,6 +275,7 @@ Here are some notable ones: |----------------|-------------| | `rustc_def_path` | Dumps the [`def_path_str`] of an item. | | `rustc_dump_def_parents` | Dumps the chain of `DefId` parents of certain definitions. | +| `rustc_dump_hidden_type_of_opaques` | Dumps the [hidden type of each opaque types][opaq] in the crate. | | `rustc_dump_inferred_outlives` | Dumps implied bounds of an item. More precisely, the [`inferred_outlives_of`] an item. | | `rustc_dump_item_bounds` | Dumps the [`item_bounds`] of an item. | | `rustc_dump_layout` | [See this section](#debugging-type-layouts). | @@ -282,7 +283,6 @@ Here are some notable ones: | `rustc_dump_predicates` | Dumps the [`predicates_of`] an item. | | `rustc_dump_variances` | Dumps the [variances] of an item. | | `rustc_dump_vtable` | Dumps the vtable layout of an impl, or a type alias of a dyn type. | -| `rustc_hidden_type_of_opaques` | Dumps the [hidden type of each opaque types][opaq] in the crate. | | `rustc_regions` | Dumps NLL closure region requirements. | | `rustc_symbol_name` | Dumps the mangled & demangled [`symbol_name`] of an item. | diff --git a/tests/ui/impl-trait/erased-regions-in-hidden-ty.rs b/tests/ui/impl-trait/erased-regions-in-hidden-ty.rs index 766c37419cd8..2e2cbad35b7c 100644 --- a/tests/ui/impl-trait/erased-regions-in-hidden-ty.rs +++ b/tests/ui/impl-trait/erased-regions-in-hidden-ty.rs @@ -5,7 +5,7 @@ //@ normalize-stderr: "DefId\([^\)]+\)" -> "DefId(..)" #![feature(rustc_attrs)] -#![rustc_hidden_type_of_opaques] +#![rustc_dump_hidden_type_of_opaques] // Make sure that the compiler can handle `ReErased` in the hidden type of an opaque. diff --git a/tests/ui/impl-trait/in-trait/dump.rs b/tests/ui/impl-trait/in-trait/dump.rs index 0a951b4fd99a..5db5e4e70a8e 100644 --- a/tests/ui/impl-trait/in-trait/dump.rs +++ b/tests/ui/impl-trait/in-trait/dump.rs @@ -1,7 +1,7 @@ //@ compile-flags: -Zverbose-internals #![feature(rustc_attrs)] -#![rustc_hidden_type_of_opaques] +#![rustc_dump_hidden_type_of_opaques] trait Foo { fn hello(&self) -> impl Sized;