about summary refs log tree commit diff
path: root/tests/ui/borrowck/unconstrained-closure-lifetime-trait-object.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/borrowck/unconstrained-closure-lifetime-trait-object.rs')
-rw-r--r--tests/ui/borrowck/unconstrained-closure-lifetime-trait-object.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/ui/borrowck/unconstrained-closure-lifetime-trait-object.rs b/tests/ui/borrowck/unconstrained-closure-lifetime-trait-object.rs
new file mode 100644
index 00000000000..3eee98d9bdb
--- /dev/null
+++ b/tests/ui/borrowck/unconstrained-closure-lifetime-trait-object.rs
@@ -0,0 +1,11 @@
+// Regression test for #139004
+use std::any::Any;
+
+type B = Box<dyn for<'a> Fn(&(dyn Any + 'a)) -> Box<dyn Any + 'a>>;
+
+fn foo<E>() -> B {
+    Box::new(|e| Box::new(e.is::<E>()))
+    //~^ ERROR the parameter type `E` may not live long enough
+}
+
+fn main() {}