2024-08-25 15:56:06 -05:00
|
|
|
// Regression test for #129021.
|
|
|
|
|
2023-04-17 23:29:01 -05:00
|
|
|
static UNIT: &'static &'static () = &&();
|
|
|
|
|
|
|
|
fn foo<'a, 'b, T>(_: &'a &'b (), v: &'b T) -> &'a T { v }
|
|
|
|
|
|
|
|
fn bad<'a, T>(x: &'a T) -> &'static T {
|
|
|
|
let f: fn(_, &'a T) -> &'static T = foo;
|
2024-08-13 16:38:24 -05:00
|
|
|
//~^ ERROR lifetime may not live long enough
|
2023-04-17 23:29:01 -05:00
|
|
|
f(UNIT, x)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|