1 // Lifetime annotation needed because we have no arguments.
2 fn f() -> &isize { //~ ERROR missing lifetime specifier
6 // Lifetime annotation needed because we have two by-reference parameters.
7 fn g(_x: &isize, _y: &isize) -> &isize { //~ ERROR missing lifetime specifier
15 // Lifetime annotation needed because we have two lifetimes: one as a parameter
16 // and one on the reference.
17 fn h(_x: &Foo) -> &isize { //~ ERROR missing lifetime specifier
21 fn i(_x: isize) -> &isize { //~ ERROR missing lifetime specifier
25 // Cases which used to work but now don't.
27 type StaticStr = &'static str; // hides 'static
28 trait WithLifetime<'a> {
29 type Output; // can hide 'a
32 // This worked because the type of the first argument contains
33 // 'static, although StaticStr doesn't even have parameters.
34 fn j(_x: StaticStr) -> &isize { //~ ERROR missing lifetime specifier
38 // This worked because the compiler resolved the argument type
39 // to <T as WithLifetime<'a>>::Output which has the hidden 'a.
40 fn k<'a, T: WithLifetime<'a>>(_x: T::Output) -> &isize {
41 //~^ ERROR missing lifetime specifier