2 // Test that we are able to type-check this example. In particular,
3 // knowing that `T: 'a` allows us to deduce that `[U]: 'a` (because
4 // when `T=[U]` it implies that `U: 'a`).
6 // Regr. test for live code we found in the wild when fixing #18937.
8 pub trait Leak<T : ?Sized> {
9 fn leak<'a>(self) -> &'a T where T: 'a;
12 impl<U> Leak<[U]> for Vec<U> {
13 fn leak<'a>(mut self) -> &'a [U] where [U]: 'a {
14 let r: *mut [U] = &mut self[..];
15 std::mem::forget(self);
20 println!("Hello, world!");