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

Update for anonymous-lifetime stabilization. #142

Merged
merged 1 commit into from
Jan 30, 2019
Merged
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `'_`, the anonymous lifetime

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

Rust 2018 allows you to explicitly mark where a lifetime is elided, for types
where this elision might otherwise be unclear. To do this, you can use the
Expand Down Expand Up @@ -36,8 +36,6 @@ impl<'a> fmt::Debug for StrWrap<'a> {
In Rust 2018, you can instead write:

```rust
#![feature(rust_2018_preview)]

# use std::fmt;
# struct StrWrap<'a>(&'a str);

Expand Down Expand Up @@ -84,8 +82,6 @@ impl<'a, 'b: 'a> Foo<'a, 'b> {
We can rewrite this as:

```rust
#![feature(rust_2018_preview)]

# struct Foo<'a, 'b: 'a> {
# field: &'a &'b str,
# }
Expand All @@ -100,4 +96,4 @@ impl Foo<'_, '_> {
This is the same, because for each `'_`, a fresh lifetime is generated.
Finally, the relationship `'a: 'b` which the struct requires must be upheld.

For more details, see the [tracking issue on In-band lifetime bindings](https://github.com/rust-lang/rust/issues/44524).
For more details, see the [tracking issue on In-band lifetime bindings](https://github.com/rust-lang/rust/issues/44524).