Skip to content

Reduce diagnostic type visibilities.#155364

Open
nnethercote wants to merge 2 commits intorust-lang:mainfrom
nnethercote:reduce-err-struct-visibilities
Open

Reduce diagnostic type visibilities.#155364
nnethercote wants to merge 2 commits intorust-lang:mainfrom
nnethercote:reduce-err-struct-visibilities

Conversation

@nnethercote
Copy link
Copy Markdown
Contributor

Most diagnostic types are only used within their own crate, and so have a pub(crate) visibility. We have some diagnostic types that are unnecessarily pub. This is bad because (a) information hiding, and (b) if a pub(crate) type becomes unused the compiler will warn but it won't warn for a pub type.

This commit eliminates unnecessary pub visibilities for some diagnostic types, and also some related things due to knock-on effects. (I found these types with some ad hoc use of grep.)

r? @Kivooeo

Most diagnostic types are only used within their own crate, and so have
a `pub(crate)` visibility. We have some diagnostic types that are
unnecessarily `pub`. This is bad because (a) information hiding, and (b)
if a `pub(crate)` type becomes unused the compiler will warn but it
won't warn for a `pub` type.

This commit eliminates unnecessary `pub` visibilities for some
diagnostic types, and also some related things due to knock-on effects.
(I found these types with some ad hoc use of `grep`.)
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 15, 2026

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

Some changes occurred in exhaustiveness checking

cc @Nadrieril

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 15, 2026
@nnethercote
Copy link
Copy Markdown
Contributor Author

After #155301 and #155319 I was thinking how to more easily catch dead diagnostic types. I realized that the compiler automatically catches them so long as they are not marked pub. So I searched for diagnostic types that were unnecessarily pub and this is the result.

@nnethercote nnethercote marked this pull request as draft April 15, 2026 22:54
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 15, 2026
@rustbot rustbot added the A-attributes Area: Attributes (`#[…]`, `#![…]`) label Apr 15, 2026
@nnethercote nnethercote marked this pull request as ready for review April 15, 2026 22:58
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 15, 2026

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann, @JonathanBrouwer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants