2 // Test that unboxed closures in contexts with free type parameters
3 // monomorphize correctly (issue #16791)
6 fn bar<'a, T:Clone+'a> (t: T) -> Box<dyn FnMut()->T + 'a> {
7 Box::new(move || t.clone())
10 let mut f = bar(42_u32);
13 let mut f = bar("forty-two");
14 assert_eq!(f(), "forty-two");
20 #[derive(Clone, Copy, Debug, PartialEq)]
21 struct Foo(usize, &'static str);
23 let x = Foo(42, "forty-two");