1 // Regression test for #98589.
2 // Previously, named lifetime `'a` that appears in the closure was unrelated to `'a`
3 // that appears in the parent function iff `'a` is early-bound.
4 // This made the following tests pass borrowck.
8 // The bound `'a: 'a` ensures that `'a` is early-bound.
9 fn test_early_early<'a: 'a, 'b: 'b>() {
10 || { None::<&'a &'b ()>; };
11 //~^ ERROR lifetime may not live long enough
14 fn test_early_late<'a: 'a, 'b>() {
15 || { None::<&'a &'b ()>; };
16 //~^ ERROR lifetime may not live long enough
19 // No early-bound lifetime; included for completeness.
20 fn test_late_late<'a, 'b>() {
21 || { None::<&'a &'b ()>; };
22 //~^ ERROR lifetime may not live long enough
25 fn test_early_type<'a: 'a, T>() {
26 || { None::<&'a T>; };
27 //~^ ERROR the parameter type `T` may not live long enough
30 // No early-bound lifetime; included for completeness.
31 fn test_late_type<'a, T>() {
32 || { None::<&'a T>; };
33 //~^ ERROR the parameter type `T` may not live long enough