1 // Test that we can derive lifetime bounds on `Self` from trait
4 trait Static : 'static { }
9 x: Option<&'a mut &'a isize>
12 fn check_bound<'a,A:'a>(x: Inv<'a>, a: A) { }
14 // In these case, `Self` inherits `'static`.
16 trait InheritsFromStatic : Sized + 'static {
17 fn foo1<'a>(self, x: Inv<'a>) {
21 trait InheritsFromStaticIndirectly : Sized + Static {
22 fn foo1<'a>(self, x: Inv<'a>) {
28 // In these case, `Self` inherits `'a`.
30 trait InheritsFromIs<'a> : Sized + 'a {
31 fn foo(self, x: Inv<'a>) {
36 trait InheritsFromIsIndirectly<'a> : Sized + Is<'a> {
37 fn foo(self, x: Inv<'a>) {
42 // In this case, `Self` inherits nothing.
44 trait InheritsFromNothing<'a> : Sized {
45 fn foo(self, x: Inv<'a>) {
47 //~^ ERROR parameter type `Self` may not live long enough