Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 2018-specific changes. #130

Merged
merged 2 commits into from
Jan 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
## Rust 2018

- [Rust 2018](rust-2018/index.md)
- [2018-Specific Changes](rust-2018/edition-changes.md)
- [Module system](rust-2018/module-system/index.md)
- [Raw identifiers](rust-2018/module-system/raw-identifiers.md)
- [Path clarity](rust-2018/module-system/path-clarity.md)
Expand Down Expand Up @@ -83,4 +84,4 @@
- [Global allocators](rust-2018/platform-and-target-support/global-allocators.md)
- [MSVC toolchain support](rust-2018/platform-and-target-support/msvc-toolchain-support.md)
- [MUSL support for fully static binaries](rust-2018/platform-and-target-support/musl-support-for-fully-static-binaries.md)
- [`cdylib` crates for C interoperability](rust-2018/platform-and-target-support/cdylib-crates-for-c-interoperability.md)
- [`cdylib` crates for C interoperability](rust-2018/platform-and-target-support/cdylib-crates-for-c-interoperability.md)
50 changes: 50 additions & 0 deletions src/rust-2018/edition-changes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# 2018-Specific Changes

The following is a summary of changes that only apply to code compiled with
the 2018 edition compared to the 2015 edition.

## Rust
- [Non-lexical lifetimes] (future inclusion planned for 2015 edition)
- [At most once] `?` macro repetition operator.
- [Path changes]:
- `use` declarations must begin with:
- `crate` – refers to the current crate.
- `self` – refers to the current module.
- `super` – refers to the parent module.
- An external crate name.
- `::` – must be followed by an external crate name. This is required
if an external crate has the same name as an in-scope item, to catch
possible ambiguities with [uniform paths] (which is planned for
inclusion soon [#55618]).
- Paths in `pub(in path)` visibility modifiers must start with `crate`,
`self`, or `super`.
- [Anonymous trait function parameters] are not allowed.
- [Trait function parameters] may use any irrefutable pattern when the
function has a body.
- [`dyn`] is a [strict keyword], in 2015 it is a [weak keyword].
- `async`, `await`, and `try` are [reserved keywords].
steveklabnik marked this conversation as resolved.
Show resolved Hide resolved
- The following lints are now deny by default:
- [overflowing_literals]
- [tyvar_behind_raw_pointer]

## Cargo
- If there is a target definition in a `Cargo.toml` manifest, it no longer
automatically disables automatic discovery of other targets.
- Target paths of the form `src/{target_name}.rs` are no longer inferred for
targets where the `path` field is not set.
- `cargo install` for the current directory is no longer allowed, you must
specify `cargo install --path .` to install the current package.

[#55618]: https://github.com/rust-lang/rust/issues/55618
[Anonymous trait function parameters]: rust-2018/trait-system/no-anon-params.html
[At most once]: rust-2018/macros/at-most-once.html
[Non-lexical lifetimes]: rust-2018/ownership-and-lifetimes/non-lexical-lifetimes.html
[Path changes]: rust-2018/module-system/path-clarity.html
[Trait function parameters]: https://doc.rust-lang.org/stable/reference/items/traits.html#parameter-patterns
[`dyn`]: rust-2018/trait-system/dyn-trait-for-trait-objects.html
[overflowing_literals]: https://github.com/rust-lang/rfcs/blob/master/text/2438-deny-integer-literal-overflow-lint.md
[reserved keywords]: https://doc.rust-lang.org/reference/keywords.html#reserved-keywords
[strict keyword]: https://doc.rust-lang.org/reference/keywords.html#strict-keywords
[tyvar_behind_raw_pointer]: https://github.com/rust-lang/rust/issues/46906
[uniform paths]: rust-2018/module-system/path-clarity.html#uniform-paths
[weak keyword]: https://doc.rust-lang.org/reference/keywords.html#weak-keywords