Skip to content

Visibility modifiers on container members #569

@scurest

Description

@scurest

Eg. these

struct {
    pub x: i32
    pub fn f() {}
    pub const v: i32 = 0;
}

which seem to do nothing (you can call private methods from anywhere AFAICT). Basically, I wanted to know if these are just unimplemented and what they're supposed to do.

  1. The stated grammar doesn't actually allow visibility modifiers on container members at all. Most of the docs use pub on struct methods though and the parser allows them in all the places above.
  2. If they were working, what's the intended unit of visibility? (I mean, where would you be allowed to access private members from?) The container, like in C++, or the file, like in Rust?
  3. The export modifier in particular seems pretty meaningless on fields.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionNo questions on the issue tracker, please.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions