Skip to content

Commit 70bf029

Browse files
steveklabnikManishearth
authored andcommitted
Note ::foo::bar() in the crates guide
Fixes #21589
1 parent 12cb7c6 commit 70bf029

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/doc/trpl/crates-and-modules.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,11 @@ place in the hierarchy instead. There's one more special form of `use`: you can
562562
people like to think of `self` as `.` and `super` as `..`, from many shells'
563563
display for the current directory and the parent directory.
564564
565+
Outside of `use`, paths are relative: `foo::bar()` refers to a function inside
566+
of `foo` relative to where we are. If that's prefixed with `::`, as in
567+
`::foo::bar()`, it refers to a different `foo`, an absolute path from your
568+
crate root.
569+
565570
Also, note that we `pub use`d before we declared our `mod`s. Rust requires that
566571
`use` declarations go first.
567572

0 commit comments

Comments
 (0)