Skip to content

Commit 783d13f

Browse files
authored
Merge pull request #130 from ehuss/2018-changes
Add 2018-specific changes.
2 parents 5e99c8c + 5521dad commit 783d13f

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

src/SUMMARY.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
## Rust 2018
1616

1717
- [Rust 2018](rust-2018/index.md)
18+
- [2018-Specific Changes](rust-2018/edition-changes.md)
1819
- [Module system](rust-2018/module-system/index.md)
1920
- [Raw identifiers](rust-2018/module-system/raw-identifiers.md)
2021
- [Path clarity](rust-2018/module-system/path-clarity.md)
@@ -83,4 +84,4 @@
8384
- [Global allocators](rust-2018/platform-and-target-support/global-allocators.md)
8485
- [MSVC toolchain support](rust-2018/platform-and-target-support/msvc-toolchain-support.md)
8586
- [MUSL support for fully static binaries](rust-2018/platform-and-target-support/musl-support-for-fully-static-binaries.md)
86-
- [`cdylib` crates for C interoperability](rust-2018/platform-and-target-support/cdylib-crates-for-c-interoperability.md)
87+
- [`cdylib` crates for C interoperability](rust-2018/platform-and-target-support/cdylib-crates-for-c-interoperability.md)

src/rust-2018/edition-changes.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# 2018-Specific Changes
2+
3+
The following is a summary of changes that only apply to code compiled with
4+
the 2018 edition compared to the 2015 edition.
5+
6+
## Rust
7+
- [Non-lexical lifetimes] (future inclusion planned for 2015 edition)
8+
- [At most once] `?` macro repetition operator.
9+
- [Path changes]:
10+
- `use` declarations must begin with:
11+
- `crate` – refers to the current crate.
12+
- `self` – refers to the current module.
13+
- `super` – refers to the parent module.
14+
- An external crate name.
15+
- `::` – must be followed by an external crate name. This is required
16+
if an external crate has the same name as an in-scope item, to catch
17+
possible ambiguities with [uniform paths] (which is planned for
18+
inclusion soon [#55618]).
19+
- Paths in `pub(in path)` visibility modifiers must start with `crate`,
20+
`self`, or `super`.
21+
- [Anonymous trait function parameters] are not allowed.
22+
- [Trait function parameters] may use any irrefutable pattern when the
23+
function has a body.
24+
- [`dyn`] is a [strict keyword], in 2015 it is a [weak keyword].
25+
- `async`, `await`, and `try` are [reserved keywords].
26+
- The following lints are now deny by default:
27+
- [overflowing_literals]
28+
- [tyvar_behind_raw_pointer]
29+
30+
## Cargo
31+
- If there is a target definition in a `Cargo.toml` manifest, it no longer
32+
automatically disables automatic discovery of other targets.
33+
- Target paths of the form `src/{target_name}.rs` are no longer inferred for
34+
targets where the `path` field is not set.
35+
- `cargo install` for the current directory is no longer allowed, you must
36+
specify `cargo install --path .` to install the current package.
37+
38+
[#55618]: https://github.com/rust-lang/rust/issues/55618
39+
[Anonymous trait function parameters]: rust-2018/trait-system/no-anon-params.html
40+
[At most once]: rust-2018/macros/at-most-once.html
41+
[Non-lexical lifetimes]: rust-2018/ownership-and-lifetimes/non-lexical-lifetimes.html
42+
[Path changes]: rust-2018/module-system/path-clarity.html
43+
[Trait function parameters]: https://doc.rust-lang.org/stable/reference/items/traits.html#parameter-patterns
44+
[`dyn`]: rust-2018/trait-system/dyn-trait-for-trait-objects.html
45+
[overflowing_literals]: https://github.com/rust-lang/rfcs/blob/master/text/2438-deny-integer-literal-overflow-lint.md
46+
[reserved keywords]: https://doc.rust-lang.org/reference/keywords.html#reserved-keywords
47+
[strict keyword]: https://doc.rust-lang.org/reference/keywords.html#strict-keywords
48+
[tyvar_behind_raw_pointer]: https://github.com/rust-lang/rust/issues/46906
49+
[uniform paths]: rust-2018/module-system/path-clarity.html#uniform-paths
50+
[weak keyword]: https://doc.rust-lang.org/reference/keywords.html#weak-keywords

0 commit comments

Comments
 (0)