]> git.proxmox.com Git - rustc.git/blame - src/doc/unstable-book/src/language-features/member-constraints.md
New upstream version 1.42.0+dfsg1
[rustc.git] / src / doc / unstable-book / src / language-features / member-constraints.md
CommitLineData
dc9dc135
XL
1# `member_constraints`
2
dfeec247 3The tracking issue for this feature is: [#61997]
dc9dc135 4
dfeec247 5[#61997]: https://github.com/rust-lang/rust/issues/61997
dc9dc135
XL
6
7------------------------
8
9The `member_constraints` feature gate lets you use `impl Trait` syntax with
10multiple unrelated lifetime parameters.
11
12A simple example is:
13
14```rust
15#![feature(member_constraints)]
16
17trait Trait<'a, 'b> { }
18impl<T> Trait<'_, '_> for T {}
19
20fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Trait<'a, 'b> {
21 (x, y)
22}
23
24fn main() { }
25```
26
27Without the `member_constraints` feature gate, the above example is an
28error because both `'a` and `'b` appear in the impl Trait bounds, but
29neither outlives the other.