]>
Commit | Line | Data |
---|---|---|
5e7ed085 FG |
1 | #### Note: this error code is no longer emitted by the compiler. |
2 | ||
f035d41b XL |
3 | In-band lifetimes were mixed with explicit lifetime binders. |
4 | ||
5 | Erroneous code example: | |
6 | ||
5e7ed085 | 7 | ```ignore (feature got removed) |
f035d41b XL |
8 | #![feature(in_band_lifetimes)] |
9 | ||
10 | fn foo<'a>(x: &'a u32, y: &'b u32) {} // error! | |
11 | ||
12 | struct Foo<'a> { x: &'a u32 } | |
13 | ||
14 | impl Foo<'a> { | |
15 | fn bar<'b>(x: &'a u32, y: &'b u32, z: &'c u32) {} // error! | |
16 | } | |
17 | ||
18 | impl<'b> Foo<'a> { // error! | |
19 | fn baz() {} | |
20 | } | |
21 | ``` | |
22 | ||
23 | In-band lifetimes cannot be mixed with explicit lifetime binders. | |
24 | For example: | |
25 | ||
26 | ``` | |
27 | fn foo<'a, 'b>(x: &'a u32, y: &'b u32) {} // ok! | |
28 | ||
29 | struct Foo<'a> { x: &'a u32 } | |
30 | ||
31 | impl<'a> Foo<'a> { | |
32 | fn bar<'b,'c>(x: &'a u32, y: &'b u32, z: &'c u32) {} // ok! | |
33 | } | |
34 | ||
35 | impl<'a> Foo<'a> { // ok! | |
36 | fn baz() {} | |
37 | } | |
38 | ``` |