@@ -23,12 +23,12 @@ Here's a brief summary:
23
23
24
24
* ` extern crate ` is no longer needed
25
25
* The ` crate ` keyword refers to the current crate.
26
- * Relative paths variant: Paths work uniformly in both ` use ` statements and in
27
- other code, both in the top-level module and in submodules, and may use
26
+ * Relative paths variant: Paths work uniformly in both ` use ` declarations and
27
+ in other code, both in the top-level module and in submodules, and may use
28
28
either absolute paths or local names relative to the current module.
29
- * Absolute use paths variant: Paths in ` use ` statements are always absolute and
30
- begin with a crate name (or ` crate ` ); paths in other code may use absolute
31
- paths or local names relative to the current module.
29
+ * Absolute use paths variant: Paths in ` use ` declarations are always absolute
30
+ and begin with a crate name (or ` crate ` ); paths in other code may use
31
+ absolute paths or local names relative to the current module.
32
32
* A ` foo.rs ` and ` foo/ ` subdirectory may coexist; ` mod.rs ` is no longer needed
33
33
when placing submodules in a subdirectory.
34
34
@@ -74,10 +74,10 @@ Check [the macro section](2018/transitioning/modules/macros.html) for more.
74
74
75
75
### The ` crate ` keyword refers to the current crate.
76
76
77
- In ` use ` statements and in other code, you can refer to the root of the current
78
- crate with the ` crate:: ` prefix. For instance, ` crate::foo::bar ` will always
79
- refer to the name ` bar ` inside the module ` foo ` , from anywhere else in the same
80
- crate.
77
+ In ` use ` declarations and in other code, you can refer to the root of the
78
+ current crate with the ` crate:: ` prefix. For instance, ` crate::foo::bar ` will
79
+ always refer to the name ` bar ` inside the module ` foo ` , from anywhere else in
80
+ the same crate.
81
81
82
82
The prefix ` :: ` previously referred to either the crate root or an external
83
83
crate; it now unambiguously refers to an external crate. For instance,
@@ -86,14 +86,14 @@ crate; it now unambiguously refers to an external crate. For instance,
86
86
### Relative paths variant
87
87
88
88
The relative paths variant of Rust 2018 simplifies and unifies path handling
89
- compared to Rust 2015. In Rust 2015, paths work differently in use statements
90
- than they do elsewhere. In particular, paths in ` use ` statements would always
91
- start from the crate root, while paths in other code implicitly started from
92
- the current module. Those differences didn't have any effect in the top-level
93
- module, which meant that everything would seem straightforward until working on
94
- a project large enough to have submodules.
95
-
96
- In the relative paths variant of Rust 2018, paths in ` use ` statements and in
89
+ compared to Rust 2015. In Rust 2015, paths work differently in ` use `
90
+ declarations than they do elsewhere. In particular, paths in ` use `
91
+ declarations would always start from the crate root, while paths in other code
92
+ implicitly started from the current module. Those differences didn't have any
93
+ effect in the top-level module, which meant that everything would seem
94
+ straightforward until working on a project large enough to have submodules.
95
+
96
+ In the relative paths variant of Rust 2018, paths in ` use ` declarations and in
97
97
other code always work the same way, both in the top-level module and in any
98
98
submodule. You can either use a relative path from the current module, an
99
99
absolute path from the top of the current crate (starting with ` crate:: ` ), or
@@ -206,7 +206,7 @@ To explicitly disambiguate a path, use `::name` for an external crate name, or
206
206
207
207
### Absolute use paths variant
208
208
209
- In the absolute use paths variant of Rust 2018, paths in ` use ` statements
209
+ In the absolute use paths variant of Rust 2018, paths in ` use ` declarations
210
210
* must* begin with one of:
211
211
212
212
- A crate name
@@ -246,9 +246,9 @@ mod foo {
246
246
use crate::foo::Bar;
247
247
```
248
248
249
- In addition, all of these path forms are available outside of ` use ` statements
250
- as well, which eliminates many sources of confusion. Consider this code in Rust
251
- 2015:
249
+ In addition, all of these path forms are available outside of ` use `
250
+ declarations as well, which eliminates many sources of confusion. Consider this
251
+ code in Rust 2015:
252
252
253
253
``` rust,ignore
254
254
// Rust 2015
0 commit comments