Skip to content

rustdoc: Make some attributes methods private. #142739

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/librustdoc/clean/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ impl Item {
Some(tcx.visibility(def_id))
}

pub(crate) fn attributes_without_repr(&self, tcx: TyCtxt<'_>, is_json: bool) -> Vec<String> {
fn attributes_without_repr(&self, tcx: TyCtxt<'_>, is_json: bool) -> Vec<String> {
Copy link
Member

@fmease fmease Jun 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is actually only called by attributes_with_repr IIRC. In #116882 I actually inline this method and rename atrributes_with_repr to attributes because repr is an attribute and since the relevant bit of Guillaume's ADT / type alias unification PR is the fact that we now have a standalone fn repr_attributes

const ALLOWED_ATTRIBUTES: &[Symbol] =
&[sym::export_name, sym::link_section, sym::no_mangle, sym::non_exhaustive];

Expand Down Expand Up @@ -799,6 +799,7 @@ impl Item {
.collect()
}

/// Get a list of attributes to display.
pub(crate) fn attributes_and_repr(
&self,
tcx: TyCtxt<'_>,
Expand All @@ -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<String> {
/// Returns a stringified `#[repr(...)]` attribute, if present.
fn repr(&self, tcx: TyCtxt<'_>, cache: &Cache, is_json: bool) -> Option<String> {
repr_attributes(tcx, cache, self.def_id()?, self.type_(), is_json)
}

Expand Down
Loading