11 type BoxedGreeter = (Box<dyn Greeter0>, Box<dyn Greeter1>);
12 //~^ HELP to declare that the trait object captures data from argument `self`, you can add a lifetime parameter `'a` in the type alias
14 struct FixedGreeter<'a>(pub &'a str);
16 impl Greeter0 for FixedGreeter<'_> {
18 println!("0 {}", self.0)
22 impl Greeter1 for FixedGreeter<'_> {
24 println!("1 {}", self.0)
28 struct Greetings(pub Vec<String>);
31 pub fn get(&self, i: usize) -> BoxedGreeter {
32 (Box::new(FixedGreeter(&self.0[i])), Box::new(FixedGreeter(&self.0[i])))
33 //~^ ERROR lifetime may not live long enough
38 let mut g = Greetings {0 : vec!()};
39 g.0.push("a".to_string());
40 g.0.push("b".to_string());