From 366c0f5b9e1341c31e22ffb7495436b4c4700c85 Mon Sep 17 00:00:00 2001 From: Matthew Woodcraft Date: Sun, 4 Aug 2024 11:21:41 +0100 Subject: [PATCH] Say that `pub(in path)` may not rely on `use` statements --- src/visibility-and-privacy.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/visibility-and-privacy.md b/src/visibility-and-privacy.md index df9f05ad8..67fd133ce 100644 --- a/src/visibility-and-privacy.md +++ b/src/visibility-and-privacy.md @@ -147,8 +147,9 @@ expressions, types, etc. In addition to public and private, Rust allows users to declare an item as visible only within a given scope. The rules for `pub` restrictions are as follows: -- `pub(in path)` makes an item visible within the provided `path`. `path` must -be an ancestor module of the item whose visibility is being declared. +- `pub(in path)` makes an item visible within the provided `path`. + `path` must be a simple path which resolves to an ancestor module of the item whose visibility is being declared. + Each identifier in `path` must refer directly to a module (not to a name introduced by a `use` statement). - `pub(crate)` makes an item visible within the current crate. - `pub(super)` makes an item visible to the parent module. This is equivalent to `pub(in super)`.