]>
Commit | Line | Data |
---|---|---|
dc9dc135 XL |
1 | # `member_constraints` |
2 | ||
dfeec247 | 3 | The 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 | ||
9 | The `member_constraints` feature gate lets you use `impl Trait` syntax with | |
10 | multiple unrelated lifetime parameters. | |
11 | ||
12 | A simple example is: | |
13 | ||
14 | ```rust | |
15 | #![feature(member_constraints)] | |
16 | ||
17 | trait Trait<'a, 'b> { } | |
18 | impl<T> Trait<'_, '_> for T {} | |
19 | ||
20 | fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Trait<'a, 'b> { | |
21 | (x, y) | |
22 | } | |
23 | ||
24 | fn main() { } | |
25 | ``` | |
26 | ||
27 | Without the `member_constraints` feature gate, the above example is an | |
28 | error because both `'a` and `'b` appear in the impl Trait bounds, but | |
29 | neither outlives the other. |