rust/tests/ui/impl-trait/type_parameters_captured.rs

13 lines
252 B
Rust

use std::fmt::Debug;
trait Any {}
impl<T> Any for T {}
// Check that type parameters are captured and not considered 'static
fn foo<T>(x: T) -> impl Any + 'static {
x
//~^ ERROR the parameter type `T` may not live long enough
}
fn main() {}