1 // Check that child trait who only has items via its *parent* trait
2 // does cause dropck to inject extra region constraints.
4 #![allow(non_camel_case_types)]
6 trait Parent { fn foo(&self); }
7 trait Child: Parent { }
9 impl Parent for i32 { fn foo(&self) { } }
10 impl<'a> Parent for &'a D_Child<i32> {
12 println!("accessing child value: {}", self.0);
16 impl Child for i32 { }
17 impl<'a> Child for &'a D_Child<i32> { }
19 struct D_Child<T:Child>(T);
20 impl <T:Child> Drop for D_Child<T> { fn drop(&mut self) { self.0.foo() } }
23 // `_d` and `d1` are assigned the *same* lifetime by region inference ...
27 // ... we store a reference to `d1` within `_d` ...
29 //~^ ERROR `d1` does not live long enough
31 // ... dropck *should* complain, because Drop of _d could (and
32 // does) access the already dropped `d1` via the `foo` method.