Skip to content

"Rust for C++ programmers" says "Struct fields are private by default" #14016

@ghost

Description

Is that correct?

This sentence is right at the start of paragraph "Visibility".

Activity

pnkfelix

pnkfelix commented on May 7, 2014

@pnkfelix
Member

Yes, they are private by default. (This was a change made ... semi-recently.)

What is leading you to think that they are not?

For further discussion, see the following tickets and RFC: #8122 , rust-lang/rfcs#1 , RFC 0004

(I will probably close this issue unless someone identifies an actual bug in the language or the documentation.)

ghost

ghost commented on May 7, 2014

@ghost

But the manual says:
"By default, everything in rust is private, with two exceptions. The first exception is that struct fields are public by default"

ghost

ghost commented on May 7, 2014

@ghost

Looks like my mistake. I thought from 0.10 compiler and manual that struct fields are public. And i did not realize that "Rust for C++ programmers" is newer than 0.10. But I see now that in the nigthly version of the manual struct fields are already "private".
Sorry.

ghost closed this as completedon May 7, 2014
added a commit that references this issue on Jan 28, 2025
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @pnkfelix

        Issue actions

          "Rust for C++ programmers" says "Struct fields are private by default" · Issue #14016 · rust-lang/rust