diff options
Diffstat (limited to 'src/test/ui/impl-trait/type_parameters_captured.rs')
-rw-r--r-- | src/test/ui/impl-trait/type_parameters_captured.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/ui/impl-trait/type_parameters_captured.rs b/src/test/ui/impl-trait/type_parameters_captured.rs new file mode 100644 index 000000000..81ee7d3f8 --- /dev/null +++ b/src/test/ui/impl-trait/type_parameters_captured.rs @@ -0,0 +1,12 @@ +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() {} |