rust/tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance-unnormalized.rs
Michael Goulet 67804c57e7 Adjust tests
2024-09-05 06:37:38 -04:00

20 lines
414 B
Rust

// Regression test for #129021.
trait ToArg<T> {
type Arg;
}
impl<T, U> ToArg<T> for U {
type Arg = T;
}
fn extend_inner<'a, 'b>(x: &'a str) -> <&'b &'a () as ToArg<&'b str>>::Arg { x }
fn extend<'a, 'b>(x: &'a str) -> &'b str {
(extend_inner as fn(_) -> _)(x)
//~^ ERROR lifetime may not live long enough
}
fn main() {
let y = extend(&String::from("Hello World"));
println!("{}", y);
}