about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorLeif Arne Storset <leifarne@storset.net>2015-07-25 21:05:32 +0200
committerLeif Arne Storset <leifarne@storset.net>2015-07-25 21:20:27 +0200
commit95c7f306c7c57f028d7e577ef13a5fc66f3086eb (patch)
treecc038ccf171ac39c74fe0ca8065cc6c001683154 /src
parente333e6a0dc60ac200e3e4c61dc0e536bee6b98af (diff)
downloadrust-95c7f306c7c57f028d7e577ef13a5fc66f3086eb.tar.gz
rust-95c7f306c7c57f028d7e577ef13a5fc66f3086eb.zip
Mention `pub` for structs and fields
Diffstat (limited to 'src')
-rw-r--r--src/doc/trpl/crates-and-modules.md4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/doc/trpl/crates-and-modules.md b/src/doc/trpl/crates-and-modules.md
index 63fdef0760f..bc2c827ca34 100644
--- a/src/doc/trpl/crates-and-modules.md
+++ b/src/doc/trpl/crates-and-modules.md
@@ -355,6 +355,10 @@ Hello in English: Hello!
 Goodbye in English: Goodbye.
 ```
 
+`pub` also applies to `struct`s and their member fields. In keeping with Rust’s
+tendency toward safety, simply making a `struct` public won't automatically
+make its members public: you must mark the fields individually with `pub`.
+
 Now that our functions are public, we can use them. Great! However, typing out
 `phrases::english::greetings::hello()` is very long and repetitive. Rust has
 another keyword for importing names into the current scope, so that you can