diff options
Diffstat (limited to 'tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.rs')
-rw-r--r-- | tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.rs b/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.rs new file mode 100644 index 000000000..060ee8821 --- /dev/null +++ b/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.rs @@ -0,0 +1,27 @@ +#![warn(unused_lifetimes)] + +pub trait X { + type Y<'a: 'static>; + //~^ WARNING unnecessary lifetime parameter +} + +impl X for () { + type Y<'a> = &'a (); +} + +struct B<'a, T: for<'r> X<Y<'r> = &'r ()>> { + f: <T as X>::Y<'a>, + //~^ ERROR lifetime bound not satisfied +} + +struct C<'a, T: X> { + f: <T as X>::Y<'a>, + //~^ ERROR lifetime bound not satisfied +} + +struct D<'a> { + f: <() as X>::Y<'a>, + //~^ ERROR lifetime bound not satisfied +} + +fn main() {} |