summaryrefslogtreecommitdiffstats
path: root/tests/ui/regions/regions-close-object-into-object-4.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/regions/regions-close-object-into-object-4.rs')
-rw-r--r--tests/ui/regions/regions-close-object-into-object-4.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/regions/regions-close-object-into-object-4.rs b/tests/ui/regions/regions-close-object-into-object-4.rs
new file mode 100644
index 000000000..3bbad9cbf
--- /dev/null
+++ b/tests/ui/regions/regions-close-object-into-object-4.rs
@@ -0,0 +1,19 @@
+trait A<T> { }
+
+struct B<'a, T:'a>(&'a (dyn A<T> + 'a));
+
+trait X { }
+impl<'a, T> X for B<'a, T> {}
+
+fn i<'a, T, U>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
+ Box::new(B(&*v)) as Box<dyn X>
+ //~^ ERROR the parameter type `U` may not live long enough [E0310]
+ //~| ERROR the parameter type `U` may not live long enough [E0310]
+ //~| ERROR the parameter type `U` may not live long enough [E0310]
+ //~| ERROR lifetime may not live long enough
+ //~| ERROR cannot return value referencing local data `*v` [E0515]
+ //~| ERROR the parameter type `U` may not live long enough [E0310]
+
+}
+
+fn main() {}