1
1
# ` '_ ` , the anonymous lifetime
2
2
3
- ![ Minimum Rust version: nightly ] ( https://img.shields.io/badge/Minimum%20Rust%20Version-nightly-red .svg )
3
+ ![ Minimum Rust version: 1.31 ] ( https://img.shields.io/badge/Minimum%20Rust%20Version-1.31-brightgreen .svg )
4
4
5
5
Rust 2018 allows you to explicitly mark where a lifetime is elided, for types
6
6
where this elision might otherwise be unclear. To do this, you can use the
@@ -36,8 +36,6 @@ impl<'a> fmt::Debug for StrWrap<'a> {
36
36
In Rust 2018, you can instead write:
37
37
38
38
``` rust
39
- #![feature(rust_2018_preview)]
40
-
41
39
# use std :: fmt;
42
40
# struct StrWrap <'a >(& 'a str );
43
41
@@ -84,8 +82,6 @@ impl<'a, 'b: 'a> Foo<'a, 'b> {
84
82
We can rewrite this as:
85
83
86
84
``` rust
87
- #![feature(rust_2018_preview)]
88
-
89
85
# struct Foo <'a , 'b : 'a > {
90
86
# field : & 'a & 'b str ,
91
87
# }
@@ -100,4 +96,4 @@ impl Foo<'_, '_> {
100
96
This is the same, because for each ` '_ ` , a fresh lifetime is generated.
101
97
Finally, the relationship ` 'a: 'b ` which the struct requires must be upheld.
102
98
103
- For more details, see the [ tracking issue on In-band lifetime bindings] ( https://github.com/rust-lang/rust/issues/44524 ) .
99
+ For more details, see the [ tracking issue on In-band lifetime bindings] ( https://github.com/rust-lang/rust/issues/44524 ) .
0 commit comments