Skip to content

Commit 6706ab8

Browse files
committed
keyword_docs: document use of in with pub keyword
Signed-off-by: Muhammad Falak R Wani <[email protected]>
1 parent 88fb06a commit 6706ab8

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

library/std/src/keyword_docs.rs

+14
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,20 @@ mod impl_keyword {}
728728
/// [`IntoIterator`]: ../book/ch13-04-performance.html
729729
/// [range patterns]: ../reference/patterns.html?highlight=range#range-patterns
730730
/// [`for`]: keyword.for.html
731+
///
732+
/// The other use of `in` is with the keyword `pub`. It allows users to declare an item as visible
733+
/// only within a given scope.
734+
///
735+
/// ## Literal Example:
736+
///
737+
/// * `pub(in crate::outer_mod) fn outer_mod_visible_fn() {}` - fn is visible in `outer_mod`
738+
///
739+
/// Starting with the 2018 edition, paths for `pub(in path)` must start with `crate`, `self` or
740+
/// `super`. The 2015 edition may also use paths starting with `::` or modules from the crate root.
741+
///
742+
/// For more information, see the [Reference].
743+
///
744+
/// [Reference]: ../reference/visibility-and-privacy.html#pubin-path-pubcrate-pubsuper-and-pubself
731745
mod in_keyword {}
732746

733747
#[doc(keyword = "let")]

0 commit comments

Comments
 (0)