From 2cf1f64b9d908e18cc9466b96166543c74e47767 Mon Sep 17 00:00:00 2001 From: Matthew Woodcraft Date: Sun, 4 Aug 2024 11:21:41 +0100 Subject: [PATCH] Say explicitly that `pub(in path)` must use a canonical path Arbitrary path expressions aren't allowed here (in particular, the path can't rely on another `use` statement). --- src/visibility-and-privacy.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/visibility-and-privacy.md b/src/visibility-and-privacy.md index df9f05ad8..fafc77da1 100644 --- a/src/visibility-and-privacy.md +++ b/src/visibility-and-privacy.md @@ -147,8 +147,8 @@ 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 the canonical path of an ancestor module of the item whose visibility is being declared. - `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)`.