Skip to content

effective visibilities: Split reachable into "reachable through interfaces" and "reachable through bounds" #120149

Open
@petrochenkov

Description

@petrochenkov

We currently have two lints as a part of #48054 - private_interfaces and private_bounds, the former being the stronger one.

struct A {}
struct B {}

pub fn leak() -> A // Warning: private_interfaces
    where B: Sized // Warning: private_bounds
{
    A {}
}

The detailed distinction is documented in the RFC, but the general idea is that with private_interfaces we can get our hands on a value of the private type A (which will result in a hard error), and with private_bounds we cannot.

In the effective visibility table it is likely reasonable to make exactly the same distinction - items reachable through interfaces (higher level of reachability), and items that are only reachable through bounds (less reachable).

In particular, the unnameable_types lint will only want to report types reachable through private interfaces, to reduce false positives.

This is a follow up to #48054.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.A-visibilityArea: Visibility / privacyL-private_boundsLint: private_boundsL-private_interfacesLint: private_interfacesT-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