1 A lifetime didn't match what was expected.
3 Erroneous code example:
10 fn bar<'short, 'long>(c: Foo<'short>, l: &'long isize) {
11 let _: Foo<'long> = c; // error!
15 In this example, we tried to set a value with an incompatible lifetime to
16 another one (`'long` is unrelated to `'short`). We can solve this issue in
19 Either we make `'short` live at least as long as `'long`:
26 // we set 'short to live at least as long as 'long
27 fn bar<'short: 'long, 'long>(c: Foo<'short>, l: &'long isize) {
28 let _: Foo<'long> = c; // ok!
32 Or we use only one lifetime:
38 fn bar<'short>(c: Foo<'short>, l: &'short isize) {
39 let _: Foo<'short> = c; // ok!