mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 02:03:53 +00:00
14 lines
300 B
Rust
14 lines
300 B
Rust
// Regression test for #129021.
|
|
|
|
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;
|
|
//~^ ERROR lifetime may not live long enough
|
|
f(UNIT, x)
|
|
}
|
|
|
|
fn main() {}
|