mirror of
https://github.com/rust-lang/book.git
synced 2026-11-30 19:44:33 -06:00
Don't leave the reader hanging wondering about use statements
And what they're relative to, if not the current module. Fixes #239.
This commit is contained in:
@@ -158,8 +158,9 @@ explanation
|
||||
Why doesn't this work? It's not because we don't have `communicator::` in front
|
||||
of the function like we had in `src/main.rs`: we are definitely within the
|
||||
`communicator` library crate here. The reason is that paths anywhere except in
|
||||
a `use` statement are relative to the current module. Our `tests` module
|
||||
doesn't have a `client` module in its scope!
|
||||
a `use` statement are relative to the current module (In a `use` statement,
|
||||
they're relative to the crate root by default). Our `tests` module doesn't have
|
||||
a `client` module in its scope!
|
||||
|
||||
So how do we get back up one module? We can either use leading colons to say
|
||||
that we want to start from the root and list the whole path:
|
||||
|
||||
Reference in New Issue
Block a user