2 impl<'a, T: Foo> Foo for &'a T {}
3 impl<T: Foo + ?Sized> Foo for Box<T> {}
6 current: Option<Box<dyn Foo + 'a>>,
10 impl<'a, T> Iterator for Iter<'a, T>
15 type Item = Box<dyn Foo + 'a>;
17 fn next(&mut self) -> Option<Self::Item> {
18 let result = self.current.take();
19 self.current = Box::new(self.remaining.next()).map(|f| Box::new(f) as _);
24 struct Bar(Vec<Box<dyn Foo>>);
27 fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> {
29 //~^ ERROR lifetime may not live long enough
31 remaining: self.0.iter(),
36 struct Baz(Vec<Box<dyn Foo>>);
39 fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> + '_ {
41 //~^ ERROR lifetime may not live long enough
43 remaining: self.0.iter(),
48 struct Bat(Vec<Box<dyn Foo>>);
51 fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> + 'a {
53 //~^ ERROR lifetime may not live long enough
55 remaining: self.0.iter(),
60 struct Ban(Vec<Box<dyn Foo>>);
63 fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> {
65 //~^ ERROR lifetime may not live long enough
67 remaining: self.0.iter(),