Skip to content

Commit 8cdee8e

Browse files
committed
explain the usage of 'as' to rename crates
Fixes #98
1 parent e35f527 commit 8cdee8e

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

src/rust-2018/module-system/path-clarity.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,29 @@ and then there is no step two. If you're not using Cargo, you already had to pas
7474
`--extern` flags to give `rustc` the location of external crates, so you'd just
7575
keep doing what you were doing there as well.
7676

77+
> One small note here: `cargo fix` will not currently automate this change. We may
78+
> have it do this for you in the future.
79+
7780
One other use for `extern crate` was to import macros; that's no longer needed.
7881
Check [the macro section](../macros/macro-changes.html) for more.
7982

80-
> One small note here: `cargo fix` will not currently automate this change. We may
81-
> have it do this for you in the future.
83+
If you've been using `as` to rename your crate like this:
84+
85+
```rust,ignore
86+
extern crate futures as f;
87+
88+
use f::Future;
89+
```
90+
91+
then removing the `extern crate` line on its own won't work. You'll need to do this:
92+
93+
```rust,ignore
94+
use futures as f;
95+
96+
use f::Future;
97+
```
98+
99+
This change will need to happen in any module that uses `f`.
82100

83101
### The `crate` keyword refers to the current crate.
84102

0 commit comments

Comments
 (0)