|
| 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