Rollup merge of #71235 - estebank:lt-sugg-2, r=ecstatic-morse

Tweak `'static` suggestion code

Fix #71196.
This commit is contained in:
Dylan DPC 2020-04-24 13:14:19 +02:00 committed by GitHub
commit 7d8a3ad128
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 573 additions and 171 deletions

View file

@ -2,9 +2,13 @@ error[E0106]: missing lifetime specifier
--> $DIR/issue-13497.rs:2:5
|
LL | &str
| ^ help: consider giving it a 'static lifetime: `&'static`
| ^ expected named lifetime parameter
|
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider using the `'static` lifetime
|
LL | &'static str
| ^^^^^^^^
error: aborting due to previous error

View file

@ -14,17 +14,25 @@ error[E0106]: missing lifetime specifier
--> $DIR/issue-26638.rs:4:40
|
LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() }
| ^ help: consider giving it an explicit bounded or 'static lifetime: `&'static`
| ^ expected named lifetime parameter
|
= help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments
help: consider using the `'static` lifetime
|
LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &'static str { iter() }
| ^^^^^^^^
error[E0106]: missing lifetime specifier
--> $DIR/issue-26638.rs:7:22
|
LL | fn parse_type_3() -> &str { unimplemented!() }
| ^ help: consider giving it a 'static lifetime: `&'static`
| ^ expected named lifetime parameter
|
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider using the `'static` lifetime
|
LL | fn parse_type_3() -> &'static str { unimplemented!() }
| ^^^^^^^^
error: aborting due to 3 previous errors