]>
Commit | Line | Data |
---|---|---|
c1a9b12d SL |
1 | fn static_id<'a,'b>(t: &'a ()) -> &'static () |
2 | where 'a: 'static { t } | |
04454e1e FG |
3 | //~^ WARN unnecessary lifetime parameter `'a` |
4 | ||
c1a9b12d SL |
5 | fn static_id_indirect<'a,'b>(t: &'a ()) -> &'static () |
6 | where 'a: 'b, 'b: 'static { t } | |
04454e1e FG |
7 | //~^ WARN unnecessary lifetime parameter `'b` |
8 | ||
c1a9b12d | 9 | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a { |
04454e1e | 10 | t |
923072b8 | 11 | //~^ ERROR lifetime may not live long enough |
c1a9b12d | 12 | } |
85aaf69f | 13 | |
c1a9b12d | 14 | fn error(u: &(), v: &()) { |
04454e1e | 15 | static_id(&u); |
923072b8 | 16 | //~^ ERROR borrowed data escapes outside of function [E0521] |
04454e1e | 17 | static_id_indirect(&v); |
923072b8 | 18 | //~^ ERROR borrowed data escapes outside of function [E0521] |
c1a9b12d | 19 | } |
223e47cc | 20 | |
d9579d0f | 21 | fn main() {} |