Rollup merge of #126013 - nnethercote:unreachable_pub, r=Urgau

Add `#[warn(unreachable_pub)]` to a bunch of compiler crates

By default `unreachable_pub` identifies things that need not be `pub` and tells you to make them `pub(crate)`. But sometimes those things don't need any kind of visibility. So they way I did these was to remove the visibility entirely for each thing the lint identifies, and then add `pub(crate)` back in everywhere the compiler said it was necessary. (Or occasionally `pub(super)` when context suggested that was appropriate.) Tedious, but results in more `pub` removal.

There are plenty more crates to do but this seems like enough for a first PR.

r? `@compiler-errors`
This commit is contained in:
Matthias Krüger 2024-08-27 00:41:57 +02:00 committed by GitHub
commit 110c3df7fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
76 changed files with 503 additions and 464 deletions

View file

@ -207,13 +207,13 @@ pub(crate) struct CopyBitcode {
#[derive(Diagnostic)]
#[diag(codegen_llvm_unknown_debuginfo_compression)]
pub struct UnknownCompression {
pub(crate) struct UnknownCompression {
pub algorithm: &'static str,
}
#[derive(Diagnostic)]
#[diag(codegen_llvm_mismatch_data_layout)]
pub struct MismatchedDataLayout<'a> {
pub(crate) struct MismatchedDataLayout<'a> {
pub rustc_target: &'a str,
pub rustc_layout: &'a str,
pub llvm_target: &'a str,