3 fn coerce(self) -> Self::Image;
8 fn coerce(self) -> Self { self }
12 fn foo(self) -> &'x T;
15 impl<'s, 'x, T: 'x> Foo<'x, T> for &'s T where &'s T: Foo2<'x, T> {
16 fn foo(self) -> &'x T { self.foo2() }
20 fn foo2(self) -> &'x T;
23 // example 1 - fails leak check
24 impl<'x> Foo2<'x, u32> for &'x u32
26 fn foo2(self) -> &'x u32 { self }
29 // example 2 - OK with this issue
30 impl<'x, 'a: 'x> Foo2<'x, i32> for &'a i32
32 fn foo2(self) -> &'x i32 { self }
35 // example 3 - fails due to issue #XYZ + Leak-check
36 impl<'x, T> Foo2<'x, u64> for T
37 where T: Mirror<Image=&'x u64>
39 fn foo2(self) -> &'x u64 { self.coerce() }
42 // example 4 - fails due to issue #XYZ
43 impl<'x, 'a: 'x, T> Foo2<'x, i64> for T
44 where T: Mirror<Image=&'a i64>
46 fn foo2(self) -> &'x i64 { self.coerce() }
51 fn ref_foo(&self) -> &'static T;
54 impl<T> RefFoo<T> for T where for<'a> &'a T: Foo<'static, T> {
55 fn ref_foo(&self) -> &'static T {
61 fn coerce_lifetime1(a: &u32) -> &'static u32
63 <u32 as RefFoo<u32>>::ref_foo(a)
64 //~^ ERROR not general enough
67 fn coerce_lifetime2(a: &i32) -> &'static i32
69 <i32 as RefFoo<i32>>::ref_foo(a)
70 //~^ ERROR not general enough
73 fn coerce_lifetime3(a: &u64) -> &'static u64
75 <u64 as RefFoo<u64>>::ref_foo(a)
76 //~^ ERROR not general enough
79 fn coerce_lifetime4(a: &i64) -> &'static i64
81 <i64 as RefFoo<i64>>::ref_foo(a)
82 //~^ ERROR not general enough