From 0170ec4079c7f8fa5e018f4f2c20aa68a5242fe7 Mon Sep 17 00:00:00 2001 From: Alona Enraght-Moony Date: Thu, 19 Jun 2025 19:37:46 +0000 Subject: [PATCH] rustdoc: Make some attributes methods private. Followup to https://www.github.com/rust-lang/rust/pull/140863 Only `Item::attributes_and_repr` should be used, the rest are implementation details that can be hidden from the rest of rustdoc. --- src/librustdoc/clean/types.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 2d9670a3d10cd..67f161fefcb0c 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -764,7 +764,7 @@ impl Item { Some(tcx.visibility(def_id)) } - pub(crate) fn attributes_without_repr(&self, tcx: TyCtxt<'_>, is_json: bool) -> Vec { + fn attributes_without_repr(&self, tcx: TyCtxt<'_>, is_json: bool) -> Vec { const ALLOWED_ATTRIBUTES: &[Symbol] = &[sym::export_name, sym::link_section, sym::no_mangle, sym::non_exhaustive]; @@ -799,6 +799,7 @@ impl Item { .collect() } + /// Get a list of attributes to display. pub(crate) fn attributes_and_repr( &self, tcx: TyCtxt<'_>, @@ -813,8 +814,8 @@ impl Item { attrs } - /// Returns a stringified `#[repr(...)]` attribute. - pub(crate) fn repr(&self, tcx: TyCtxt<'_>, cache: &Cache, is_json: bool) -> Option { + /// Returns a stringified `#[repr(...)]` attribute, if present. + fn repr(&self, tcx: TyCtxt<'_>, cache: &Cache, is_json: bool) -> Option { repr_attributes(tcx, cache, self.def_id()?, self.type_(), is_json) }