3 #[derive(Debug, Clone)]
4 struct S<T: 'static>(T);
6 // S<&'a T> is in the return type, so we get an implied bound
8 fn foo<'a, T>(x: &'a T) -> (S<&'a T>, Box<dyn Any + 'static>) {
11 let z = Box::new(y.clone()) as Box<dyn Any + 'static>;
18 // Check that we require that the argument is of type `&'static String`,
19 // so that the return type is well-formed.
20 let (_, z) = foo(&"hello".to_string());
21 //~^ ERROR temporary value dropped while borrowed
23 println!("{:?}", z.downcast_ref::<S<&'static String>>());