From 363d87442a7772d6c2258fcad6864878d7b7dd35 Mon Sep 17 00:00:00 2001 From: Pyry Kontio Date: Tue, 28 Feb 2017 00:08:42 +0200 Subject: [PATCH 1/2] Improved wording with the privacy explanation. --- src/doc/reference/src/visibility-and-privacy.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/doc/reference/src/visibility-and-privacy.md b/src/doc/reference/src/visibility-and-privacy.md index 50d3e7507d0ed..b6a4180951820 100644 --- a/src/doc/reference/src/visibility-and-privacy.md +++ b/src/doc/reference/src/visibility-and-privacy.md @@ -40,7 +40,10 @@ With the notion of an item being either public or private, Rust allows item accesses in two cases: 1. If an item is public, then it can be used externally through any of its - public ancestors. + accessible ancestors (either by anyone that has an access to an ancestor + in the case of a chain of public ancestors, + or by the siblings of a private ancestor, in the case of a chain of public + ancestors terminating into a private ancestor). 2. If an item is private, it may be accessed by the current module and its descendants. From 1916cc9601755c28393724efece008e8422b54db Mon Sep 17 00:00:00 2001 From: Pyry Kontio Date: Wed, 1 Mar 2017 23:07:11 +0200 Subject: [PATCH 2/2] Reworded stuff. --- src/doc/reference/src/visibility-and-privacy.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/doc/reference/src/visibility-and-privacy.md b/src/doc/reference/src/visibility-and-privacy.md index b6a4180951820..f431872e3478e 100644 --- a/src/doc/reference/src/visibility-and-privacy.md +++ b/src/doc/reference/src/visibility-and-privacy.md @@ -39,11 +39,9 @@ pub enum State { With the notion of an item being either public or private, Rust allows item accesses in two cases: -1. If an item is public, then it can be used externally through any of its - accessible ancestors (either by anyone that has an access to an ancestor - in the case of a chain of public ancestors, - or by the siblings of a private ancestor, in the case of a chain of public - ancestors terminating into a private ancestor). +1. If an item is public, then it can be accessed externally from some module + `m` if you can access all the item's parent modules from `m`. You can + also potentially be able to name the item through re-exports. See below. 2. If an item is private, it may be accessed by the current module and its descendants.