1 // Regression test for #18937.
6 struct MyString<'a>(&'a String);
9 list: Vec<Box<dyn fmt::Debug>>,
13 fn foo<F>(&mut self, f: F)
14 where F: fmt::Debug + 'a,
18 impl<'a> A<'a> for B {
19 fn foo<F>(&mut self, f: F) //~ ERROR impl has stricter
20 where F: fmt::Debug + 'static,
22 self.list.push(Box::new(f));
27 let mut b = B { list: Vec::new() };
29 // Create a borrowed pointer, put it in `b`, then drop what's borrowing it
30 let a = "hello".to_string();
33 // Drop the data which `b` has a reference to
36 // Use the data, probably segfaulting
37 for b in b.list.iter() {