Open
Description
Code
#![allow(unused)]
struct Type<T>(T);
mod a {
trait Trait {}
impl<T: Trait> super::Type<T> {}
}
Current output
warning: trait `Trait` is more private than the item `a::<impl Type<T>>`
--> src/lib.rs:5:5
|
5 | impl<T: Trait> super::Type<T> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation `a::<impl Type<T>>` is reachable at visibility `pub(crate)`
|
note: but trait `Trait` is only usable at visibility `pub(self)`
--> src/lib.rs:4:5
|
4 | trait Trait {}
| ^^^^^^^^^^^
= note: `#[warn(private_bounds)]` on by default
Desired output
No warning
Rationale and extra context
No items inside the impl exist that leak private details, and the mere existence of the impl shouldn't be an issue. Same warning appears if the impl is non-empty.
I think the warning should be on individual items inside the impl rather than the impl itself.
Other cases
Rust Version
rustc 1.88.0-nightly (1799887bb 2025-03-29)
binary: rustc
commit-hash: 1799887bb281d1ab49287750f1950b8c738c6b77
commit-date: 2025-03-29
host: x86_64-unknown-linux-gnu
release: 1.88.0-nightly
LLVM version: 20.1.1
Anything else?
No response