Skip to content

Commit b5cddd9

Browse files
committed
Add 2018-specific changes.
1 parent 4de2b79 commit b5cddd9

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

src/SUMMARY.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,5 @@
8383
- [Global allocators](rust-2018/platform-and-target-support/global-allocators.md)
8484
- [MSVC toolchain support](rust-2018/platform-and-target-support/msvc-toolchain-support.md)
8585
- [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)
86+
- [`cdylib` crates for C interoperability](rust-2018/platform-and-target-support/cdylib-crates-for-c-interoperability.md)
87+
- [2018-Specific Changes](rust-2018/edition-changes.md)

src/rust-2018/edition-changes.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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].
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 future module changes.
18+
- Paths in `pub(in path)` visibility modifiers must start with `crate`,
19+
`self`, or `super`.
20+
- [Anonymous trait function parameters] are not allowed.
21+
- [Trait function parameters] may use any irrefutable pattern when the
22+
function has a body.
23+
- [`dyn`] is a [strict keyword], in 2015 it is a [weak keyword].
24+
- `async`, `await`, and `try` are [reserved keywords].
25+
- The following lints are now deny by default:
26+
- [overflowing_literals]
27+
- [tyvar_behind_raw_pointer]
28+
29+
## Cargo
30+
- If there is a target definition in a `Cargo.toml` manifest, it no longer
31+
automatically disables automatic discovery of other targets.
32+
- Target paths of the form `src/{target_name}.rs` are no longer inferred for
33+
targets where the `path` field is not set.
34+
- `cargo install` for the current directory is no longer allowed, you must
35+
specify `cargo install --path .` to install the current package.
36+
37+
[Anonymous trait function parameters]: rust-2018/trait-system/no-anon-params.html
38+
[At most once]: rust-2018/macros/at-most-once.html
39+
[Non-lexical lifetimes]: rust-2018/ownership-and-lifetimes/non-lexical-lifetimes.html
40+
[Path changes]: rust-2018/module-system/path-clarity.html
41+
[Trait function parameters]: https://doc.rust-lang.org/stable/reference/items/traits.html#parameter-patterns
42+
[`dyn`]: rust-2018/trait-system/dyn-trait-for-trait-objects.html
43+
[overflowing_literals]: https://github.com/rust-lang/rfcs/blob/master/text/2438-deny-integer-literal-overflow-lint.md
44+
[reserved keywords]: https://doc.rust-lang.org/reference/keywords.html#reserved-keywords
45+
[strict keyword]: https://doc.rust-lang.org/reference/keywords.html#strict-keywords
46+
[tyvar_behind_raw_pointer]: https://github.com/rust-lang/rust/issues/46906
47+
[weak keyword]: https://doc.rust-lang.org/reference/keywords.html#weak-keywords

0 commit comments

Comments
 (0)