From 83231859417efc363d6929b58d75cdcf40bb5f2d Mon Sep 17 00:00:00 2001 From: Liigo Zhuang Date: Wed, 7 Dec 2016 16:37:38 +0800 Subject: [PATCH 1/2] minor fix about visibility in reference --- src/doc/reference.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/doc/reference.md b/src/doc/reference.md index bf286aaec4bb3..ce3fef982b962 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -1731,7 +1731,8 @@ of an item to see whether it should be allowed or not. This is where privacy warnings are generated, or otherwise "you used a private item of another module and weren't allowed to." -By default, everything in Rust is *private*, with one exception. Enum variants +By default, everything in Rust is *private*, with two exceptions: Associated +items of a Trait are public by default; Enum variants in a `pub` enum are also public by default. When an item is declared as `pub`, it can be thought of as being accessible to the outside world. For example: From e095c710f73ae98cdc769a3e7992d3a44e91bb8f Mon Sep 17 00:00:00 2001 From: Liigo Date: Tue, 13 Dec 2016 20:21:00 +0800 Subject: [PATCH 2/2] Associated items and variants inherit visibility from their traits and enums respectively. --- src/doc/reference.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/reference.md b/src/doc/reference.md index ce3fef982b962..b5a91a170d8ed 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -1732,7 +1732,7 @@ warnings are generated, or otherwise "you used a private item of another module and weren't allowed to." By default, everything in Rust is *private*, with two exceptions: Associated -items of a Trait are public by default; Enum variants +items in a `pub` Trait are public by default; Enum variants in a `pub` enum are also public by default. When an item is declared as `pub`, it can be thought of as being accessible to the outside world. For example: