From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- .../ui/regions/regions-close-param-into-object.rs | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/ui/regions/regions-close-param-into-object.rs (limited to 'tests/ui/regions/regions-close-param-into-object.rs') diff --git a/tests/ui/regions/regions-close-param-into-object.rs b/tests/ui/regions/regions-close-param-into-object.rs new file mode 100644 index 000000000..2760e5eed --- /dev/null +++ b/tests/ui/regions/regions-close-param-into-object.rs @@ -0,0 +1,27 @@ +trait X { fn foo(&self) {} } + +fn p1(v: T) -> Box + where T : X +{ + Box::new(v) //~ ERROR parameter type `T` may not live long enough +} + +fn p2(v: Box) -> Box + where Box : X +{ + Box::new(v) //~ ERROR parameter type `T` may not live long enough +} + +fn p3<'a,T>(v: T) -> Box + where T : X +{ + Box::new(v) //~ ERROR parameter type `T` may not live long enough +} + +fn p4<'a,T>(v: Box) -> Box + where Box : X +{ + Box::new(v) //~ ERROR parameter type `T` may not live long enough +} + +fn main() {} -- cgit v1.2.3