1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // Regression test for #18937.
16 struct MyString<'a>(&'a String);
19 list: Vec<Box<fmt::Debug>>,
23 fn foo<F>(&mut self, f: F)
24 where F: fmt::Debug + 'a,
28 impl<'a> A<'a> for B {
29 fn foo<F>(&mut self, f: F) //~ ERROR impl has stricter
30 where F: fmt::Debug + 'static,
32 self.list.push(Box::new(f));
37 let mut b = B { list: Vec::new() };
39 // Create a borrowed pointer, put it in `b`, then drop what's borrowing it
40 let a = "hello".to_string();
43 // Drop the data which `b` has a reference to
46 // Use the data, probably segfaulting
47 for b in b.list.iter() {