Suggest 'r instead of 'lifetime

This commit is contained in:
Esteban Küber 2020-01-27 12:49:12 -08:00
parent 7e1464336a
commit fa4594196d
19 changed files with 120 additions and 59 deletions

View file

@ -11,8 +11,8 @@ LL | type Foo = fn(&u8, &u8) -> &u8;
| ^^^ ^^^
help: consider introducing a named lifetime parameter
|
LL | type Foo<'lifetime> = fn(&'lifetime u8, &'lifetime u8) -> &'lifetime u8;
| ^^^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^
LL | type Foo<'r> = fn(&'r u8, &'r u8) -> &'r u8;
| ^^^^ ^^^^^^ ^^^^^^ ^^^
error[E0106]: missing lifetime specifier
--> $DIR/issue-19707.rs:5:27
@ -28,12 +28,12 @@ LL | fn bar<F: Fn(&u8, &u8) -> &u8>(f: &F) {}
= note: for more information on Higher-Ranked lifetimes, visit https://doc.rust-lang.org/nomicon/hrtb.html
help: consider introducing a Higher-Ranked lifetime
|
LL | fn bar<F: for<'lifetime> Fn(&'lifetime u8, &'lifetime u8) -> &'lifetime u8>(f: &F) {}
| ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^
LL | fn bar<F: for<'r> Fn(&'r u8, &'r u8) -> &'r u8>(f: &F) {}
| ^^^^^^^ ^^^^^^ ^^^^^^ ^^^
help: consider introducing a named lifetime parameter
|
LL | fn bar<'lifetime, F: Fn(&'lifetime u8, &'lifetime u8) -> &'lifetime u8>(f: &F) {}
| ^^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^
LL | fn bar<'r, F: Fn(&'r u8, &'r u8) -> &'r u8>(f: &F) {}
| ^^^ ^^^^^^ ^^^^^^ ^^^
error: aborting due to 2 previous errors

View file

@ -11,8 +11,8 @@ LL | fn parse_type(iter: Box<dyn Iterator<Item=&str>+'static>) -> &str { iter.ne
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: consider introducing a named lifetime parameter
|
LL | fn parse_type<'lifetime>(iter: Box<dyn Iterator<Item=&str>+'static>) -> &'lifetime str { iter.next() }
| ^^^^^^^^^^^ ^^^^^^^^^^
LL | fn parse_type<'r>(iter: Box<dyn Iterator<Item=&str>+'static>) -> &'r str { iter.next() }
| ^^^^ ^^^
error[E0106]: missing lifetime specifier
--> $DIR/issue-26638.rs:4:40

View file

@ -11,8 +11,8 @@ LL | fn f(a: &S, b: i32) -> &i32 {
| ^^
help: consider introducing a named lifetime parameter
|
LL | fn f<'lifetime>(a: &'lifetime S, b: i32) -> &'lifetime i32 {
| ^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^
LL | fn f<'r>(a: &'r S, b: i32) -> &'r i32 {
| ^^^^ ^^^^^ ^^^
error[E0106]: missing lifetime specifier
--> $DIR/issue-30255.rs:14:34
@ -27,8 +27,8 @@ LL | fn g(a: &S, b: bool, c: &i32) -> &i32 {
| ^^ ^^^^
help: consider introducing a named lifetime parameter
|
LL | fn g<'lifetime>(a: &'lifetime S, b: bool, c: &'lifetime i32) -> &'lifetime i32 {
| ^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^ ^^^^^^^^^^
LL | fn g<'r>(a: &'r S, b: bool, c: &'r i32) -> &'r i32 {
| ^^^^ ^^^^^ ^^^^^^^ ^^^
error[E0106]: missing lifetime specifier
--> $DIR/issue-30255.rs:19:44
@ -43,8 +43,8 @@ LL | fn h(a: &bool, b: bool, c: &S, d: &i32) -> &i32 {
| ^^^^^ ^^ ^^^^
help: consider introducing a named lifetime parameter
|
LL | fn h<'lifetime>(a: &'lifetime bool, b: bool, c: &'lifetime S, d: &'lifetime i32) -> &'lifetime i32 {
| ^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^ ^^^^^^^^^^
LL | fn h<'r>(a: &'r bool, b: bool, c: &'r S, d: &'r i32) -> &'r i32 {
| ^^^^ ^^^^^^^^ ^^^^^ ^^^^^^^ ^^^
error: aborting due to 3 previous errors