Skip to content

Commit 494b45c

Browse files
committed
Drop "uniform path" terminology.
1 parent a2576a1 commit 494b45c

File tree

2 files changed

+18
-27
lines changed

2 files changed

+18
-27
lines changed

src/rust-2018/edition-changes.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ the 2018 edition compared to the 2015 edition.
77
- [Non-lexical lifetimes] (future inclusion planned for 2015 edition)
88
- [At most once] `?` macro repetition operator.
99
- [Path changes]:
10-
- [Uniform paths] in `use` declarations.
11-
- Paths staring with `::` must be followed with an external crate.
10+
- Paths in `use` declarations work the same as other paths.
11+
- Paths starting with `::` must be followed with an external crate.
1212
- Paths in `pub(in path)` visibility modifiers must start with `crate`,
1313
`self`, or `super`.
1414
- [Anonymous trait function parameters] are not allowed.
@@ -38,5 +38,4 @@ the 2018 edition compared to the 2015 edition.
3838
[reserved keywords]: https://doc.rust-lang.org/reference/keywords.html#reserved-keywords
3939
[strict keyword]: https://doc.rust-lang.org/reference/keywords.html#strict-keywords
4040
[tyvar_behind_raw_pointer]: https://github.com/rust-lang/rust/issues/46906
41-
[uniform paths]: rust-2018/module-system/path-clarity.html#uniform-paths
4241
[weak keyword]: https://doc.rust-lang.org/reference/keywords.html#weak-keywords

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

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Here's a brief summary:
2020
* Paths starting with `::` must reference an external crate.
2121
* A `foo.rs` and `foo/` subdirectory may coexist; `mod.rs` is no longer needed
2222
when placing submodules in a subdirectory.
23-
* `use` declarations take [uniform paths](#uniform-paths).
23+
* Paths in `use` declarations work the same as other paths.
2424

2525
These may seem like arbitrary new rules when put this way, but the mental
2626
model is now significantly simplified overall. Read on for more details!
@@ -140,9 +140,6 @@ mod submodule {
140140
// but in a submodule it requires a leading :: if not imported with `use`
141141
let x = ::chrono::Utc::now();
142142
}
143-
144-
// unlike expressions, `use` paths were allowed to reference crates directly
145-
use chrono::Local;
146143
}
147144
```
148145

@@ -162,9 +159,6 @@ mod submodule {
162159
// crates may be referenced directly, even in submodules
163160
let x = chrono::Utc::now();
164161
}
165-
166-
// `use` paths have the same path style
167-
use chrono::Local;
168162
}
169163
```
170164

@@ -201,23 +195,22 @@ and the submodule is still `foo/bar.rs`. This eliminates the special
201195
name, and if you have a bunch of files open in your editor, you can clearly
202196
see their names, instead of having a bunch of tabs named `mod.rs`.
203197

204-
# Uniform paths
198+
### `use` paths
205199

206200
![Minimum Rust version: 1.32](https://img.shields.io/badge/Minimum%20Rust%20Version-1.32-brightgreen.svg)
207201

208-
The uniform paths variant of Rust 2018 simplifies and unifies path handling
209-
compared to Rust 2015. In Rust 2015, paths work differently in `use`
210-
declarations than they do elsewhere. In particular, paths in `use`
211-
declarations would always start from the crate root, while paths in other code
212-
implicitly started from the current scope. Those differences didn't have any
213-
effect in the top-level module, which meant that everything would seem
214-
straightforward until working on a project large enough to have submodules.
202+
Rust 2018 simplifies and unifies path handling compared to Rust 2015. In Rust
203+
2015, paths work differently in `use` declarations than they do elsewhere. In
204+
particular, paths in `use` declarations would always start from the crate
205+
root, while paths in other code implicitly started from the current scope.
206+
Those differences didn't have any effect in the top-level module, which meant
207+
that everything would seem straightforward until working on a project large
208+
enough to have submodules.
215209

216-
In the uniform paths variant of Rust 2018, paths in `use` declarations and in
217-
other code almost always work the same way, both in the top-level module and
218-
in any submodule. You can use a relative path from the current scope, a path
219-
starting from an external crate name, or a path starting with `crate`,
220-
`super`, or `self`.
210+
In Rust 2018, paths in `use` declarations and in other code work the same way,
211+
both in the top-level module and in any submodule. You can use a relative path
212+
from the current scope, a path starting from an external crate name, or a path
213+
starting with `crate`, `super`, or `self`.
221214

222215
Code that looked like this:
223216

@@ -255,7 +248,7 @@ will look exactly the same in Rust 2018, except that you can delete the `extern
255248
crate` line:
256249

257250
```rust,ignore
258-
// Rust 2018 (uniform paths variant)
251+
// Rust 2018
259252
260253
use futures::Future;
261254
@@ -282,11 +275,10 @@ fn func() {
282275
}
283276
```
284277

285-
With uniform paths, however, the same code will also work completely unmodified in
286-
a submodule:
278+
The same code will also work completely unmodified in a submodule:
287279

288280
```rust,ignore
289-
// Rust 2018 (uniform paths variant)
281+
// Rust 2018
290282
291283
mod submodule {
292284
use futures::Future;

0 commit comments

Comments
 (0)