File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 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.
154154- ` pub(self) ` makes an item visible to the current module. This is equivalent
155155to ` pub(in self) ` .
156156
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+
157161Here's an example:
158162
159163``` rust
160164pub mod outer_mod {
161165 pub mod inner_mod {
162166 // 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 () {}
164170
165171 // This function is visible to the entire crate
166172 pub (crate ) fn crate_visible_fn () {}
You can’t perform that action at this time.
0 commit comments