Skip to content

private_bounds: false negative on trait impl #139159

Open
@Kyuuhachi

Description

@Kyuuhachi

Code

#![allow(unused)]
struct Type<T>(T);
trait PubTrait {}
mod a {
    trait PrivTrait {}
    impl<T: PrivTrait> super::PubTrait for super::Type<T> {}
}

Current output

None

Desired output

private_bounds warning

Rationale and extra context

The T: PrivTrait bound is more private than both PubTrait and Type, so that should give a warning.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.L-false-negativeLint: False negative (should have fired but didn't).L-private_boundsLint: private_boundsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions