Skip to content

Update now that NLL is enabled in 2015. #157

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

Merged
merged 1 commit into from
May 4, 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
1 change: 0 additions & 1 deletion src/rust-2018/edition-changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
The following is a summary of changes that only apply to code compiled with
the 2018 edition compared to the 2015 edition.

- [Non-lexical lifetimes] (future inclusion planned for 2015 edition)
- [At most once] `?` macro repetition operator.
- [Path changes]:
- Paths in `use` declarations work the same as other paths.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Non-lexical lifetimes

![Minimum Rust version: 1.31](https://img.shields.io/badge/Minimum%20Rust%20Version-1.31-brightgreen.svg)
![Minimum Rust version: 1.31](https://img.shields.io/badge/Minimum%20Rust%20Version-1.31-brightgreen.svg) for 2018 edition

![Minimum Rust version: 1.36](https://img.shields.io/badge/Minimum%20Rust%20Version-1.36-brightgreen.svg) for 2015 edition

The borrow checker has been enhanced to accept more code, via a mechanism
called "non-lexical lifetimes." Consider this example:
Expand Down Expand Up @@ -44,7 +46,7 @@ fn main() {
let mut x = 5;
let y = &x;
let z = &mut x;

println!("y: {}", y);
}
```
Expand Down Expand Up @@ -74,7 +76,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta
| -- immutable borrow occurs here
5 | let z = &mut x;
| ^^^^^^ mutable borrow occurs here
6 |
6 |
7 | println!("y: {}", y);
| - borrow later used here
```
Expand Down