Skip to content

Commit d3c9c94

Browse files
authored
Merge pull request #157 from ehuss/nll-2015
Update now that NLL is enabled in 2015.
2 parents c413d42 + cb02513 commit d3c9c94

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/rust-2018/edition-changes.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
The following is a summary of changes that only apply to code compiled with
44
the 2018 edition compared to the 2015 edition.
55

6-
- [Non-lexical lifetimes] (future inclusion planned for 2015 edition)
76
- [At most once] `?` macro repetition operator.
87
- [Path changes]:
98
- Paths in `use` declarations work the same as other paths.

src/rust-2018/ownership-and-lifetimes/non-lexical-lifetimes.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Non-lexical lifetimes
22

3-
![Minimum Rust version: 1.31](https://img.shields.io/badge/Minimum%20Rust%20Version-1.31-brightgreen.svg)
3+
![Minimum Rust version: 1.31](https://img.shields.io/badge/Minimum%20Rust%20Version-1.31-brightgreen.svg) for 2018 edition
4+
5+
![Minimum Rust version: 1.36](https://img.shields.io/badge/Minimum%20Rust%20Version-1.36-brightgreen.svg) for 2015 edition
46

57
The borrow checker has been enhanced to accept more code, via a mechanism
68
called "non-lexical lifetimes." Consider this example:
@@ -44,7 +46,7 @@ fn main() {
4446
let mut x = 5;
4547
let y = &x;
4648
let z = &mut x;
47-
49+
4850
println!("y: {}", y);
4951
}
5052
```
@@ -74,7 +76,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta
7476
| -- immutable borrow occurs here
7577
5 | let z = &mut x;
7678
| ^^^^^^ mutable borrow occurs here
77-
6 |
79+
6 |
7880
7 | println!("y: {}", y);
7981
| - borrow later used here
8082
```

0 commit comments

Comments
 (0)