]>
Commit | Line | Data |
---|---|---|
85aaf69f | 1 | #![allow(dead_code)] |
223e47cc | 2 | |
9346a6ac AL |
3 | // Test that even when `Self` is only used in covariant position, it |
4 | // is treated as invariant. | |
5 | ||
85aaf69f SL |
6 | trait Get { |
7 | fn get() -> Self; | |
8 | } | |
1a4d82fc | 9 | |
85aaf69f SL |
10 | fn get_min_from_max<'min, 'max, G>() |
11 | where 'max : 'min, G : 'max, &'max G : Get | |
12 | { | |
9346a6ac | 13 | // Previously OK, now an error as traits are invariant. |
04454e1e | 14 | impls_get::<&'min G>(); |
923072b8 | 15 | //~^ ERROR lifetime may not live long enough |
85aaf69f SL |
16 | } |
17 | ||
18 | fn get_max_from_min<'min, 'max, G>() | |
19 | where 'max : 'min, G : 'max, &'min G : Get | |
20 | { | |
04454e1e | 21 | impls_get::<&'max G>(); |
923072b8 | 22 | //~^ ERROR lifetime may not live long enough |
85aaf69f SL |
23 | } |
24 | ||
25 | fn impls_get<G>() where G : Get { } | |
223e47cc LB |
26 | |
27 | fn main() { } |