rust/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
300 B
Rust
Raw Normal View History

2024-08-25 15:56:06 -05:00
// 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() {}