File tree 1 file changed +7
-1
lines changed
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -154,13 +154,19 @@ be a parent module of the item whose visibility is being declared.
154
154
- ` pub(self) ` makes an item visible to the current module. This is equivalent
155
155
to ` pub(in self) ` .
156
156
157
+ > ** Edition Differences** : Starting with the 2018 edition, paths for
158
+ > ` pub(in path) ` must start with ` crate ` , ` self ` , or ` super ` . The 2015 edition
159
+ > may also use paths starting with ` :: ` or modules from the crate root.
160
+
157
161
Here's an example:
158
162
159
163
``` rust
160
164
pub mod outer_mod {
161
165
pub mod inner_mod {
162
166
// This function is visible within `outer_mod`
163
- pub (in outer_mod ) fn outer_mod_visible_fn () {}
167
+ pub (in crate :: outer_mod ) fn outer_mod_visible_fn () {}
168
+ // Same as above, this is only valid in the 2015 edition.
169
+ pub (in outer_mod ) fn outer_mod_visible_fn_2015 () {}
164
170
165
171
// This function is visible to the entire crate
166
172
pub (crate ) fn crate_visible_fn () {}
You can’t perform that action at this time.
0 commit comments