Skip to content

RFC: Forbid pub and priv in positions where they do not change the default behavior #5495

Closed
@bstrie

Description

@bstrie

Right now structs are private-by-default and struct fields are public-by-default. And yet this is legal:

priv struct Foo {
    pub bar: int
}

fn main() {}

The pub and priv declarations there are meaningless. Allowing them in those positions will increase confusion over what the defaults actually are. I propose that this be forbidden.

Metadata

Metadata

Assignees

Labels

A-frontendArea: Compiler frontend (errors, parsing and HIR)A-grammarArea: The grammar of RustA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions