about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-03-19 02:02:02 +0100
committerGitHub <noreply@github.com>2022-03-19 02:02:02 +0100
commit463e516b0c53683fc8f5c3d2b4d1341b2b69e0fe (patch)
treea35dba9c7addf9b06abcd4c9381a6272e6253542
parentfe55eee9a55a1019a2398d22b91bc201e3d4fb94 (diff)
parent6706ab8cfbe2bd3d093b5f995f5e59e42a1285c2 (diff)
downloadrust-463e516b0c53683fc8f5c3d2b4d1341b2b69e0fe.tar.gz
rust-463e516b0c53683fc8f5c3d2b4d1341b2b69e0fe.zip
Rollup merge of #93692 - mfrw:mfrw/document-keyword-in, r=dtolnay
keyword_docs: document use of `in` with `pub` keyword

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>

Fixes: #93609
-rw-r--r--library/std/src/keyword_docs.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/library/std/src/keyword_docs.rs b/library/std/src/keyword_docs.rs
index 542b793f6da..bc2384c88d2 100644
--- a/library/std/src/keyword_docs.rs
+++ b/library/std/src/keyword_docs.rs
@@ -728,6 +728,20 @@ mod impl_keyword {}
 /// [`IntoIterator`]: ../book/ch13-04-performance.html
 /// [range patterns]: ../reference/patterns.html?highlight=range#range-patterns
 /// [`for`]: keyword.for.html
+///
+/// The other use of `in` is with the keyword `pub`. It allows users to declare an item as visible
+/// only within a given scope.
+///
+/// ## Literal Example:
+///
+///    * `pub(in crate::outer_mod) fn outer_mod_visible_fn() {}` - fn is visible in `outer_mod`
+///
+/// Starting with the 2018 edition, paths for `pub(in path)` must start with `crate`, `self` or
+/// `super`. The 2015 edition may also use paths starting with `::` or modules from the crate root.
+///
+/// For more information, see the [Reference].
+///
+/// [Reference]: ../reference/visibility-and-privacy.html#pubin-path-pubcrate-pubsuper-and-pubself
 mod in_keyword {}
 
 #[doc(keyword = "let")]