Skip to content

Fields of private structures should be private by default #11522

Closed
@alexcrichton

Description

@alexcrichton

It was brought up recently that the rules for field privacy aren't quite as they were intended to be. Currently, fields are public by default, and you explicitly make them private. In the originally envisioned world, this was only true of pub structs. Private structs would have private-by-default.

This essentially means that the default visibility of fields inherits the visibility of the struct. I would also like to go so far as to disallow pub on fields of a private structure.

Nominating

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-visibilityArea: Visibility / privacy

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions