Skip to content

Commit e5f1c02

Browse files
committed
rust-2018/path-changes: updates for Rust 1.72
Since rust-lang/rust#112086, paths in `use` statements have the same shadowing rules as other paths, at least for the simple cases we're talking about in this guide. The case of an external crate having the same name as a local module still seems worth mentioning, so I've put it in the "Extern crate paths" section.
1 parent 1ff3909 commit e5f1c02

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/rust-2018/path-changes.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,11 @@ mod submodule {
206206
}
207207
```
208208

209+
If you have a local module or item with the same name as an external crate, a
210+
path begining with that name will be taken to refer to the local module or
211+
item. To explicitly refer to the external crate, use the `::name` form.
212+
213+
209214
### No more `mod.rs`
210215

211216
In Rust 2015, if you have a submodule:
@@ -371,9 +376,3 @@ mod submodule {
371376

372377
This makes it easy to move code around in a project, and avoids introducing
373378
additional complexity to multi-module projects.
374-
375-
If a path is ambiguous, such as if you have an external crate and a local
376-
module or item with the same name, you'll get an error, and you'll need to
377-
either rename one of the conflicting names or explicitly disambiguate the path.
378-
To explicitly disambiguate a path, use `::name` for an external crate name, or
379-
`self::name` for a local module or item.

0 commit comments

Comments
 (0)