Skip to content

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

Open

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.

Activity

  1. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jan 19, 2024
  2. added
    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.
    A-visibilityArea: Visibility / privacy
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jan 22, 2024
  3. added a commit that references this issue on Apr 8, 2024
  4. added a commit that references this issue on Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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