1 An underscore `_` character has been used as the identifier for a lifetime.
3 Erroneous code example:
5 ```compile_fail,E0106,E0637
6 fn longest<'_>(str1: &'_ str, str2: &'_ str) -> &'_ str {
7 //^^ `'_` is a reserved lifetime name
8 if str1.len() > str2.len() {
16 `'_`, cannot be used as a lifetime identifier because it is a reserved for the
17 anonymous lifetime. To fix this, use a lowercase letter such as 'a, or a series
18 of lowercase letters such as `'foo`. For more information, see [the
19 book][bk-no]. For more information on using the anonymous lifetime in rust
20 nightly, see [the nightly book][bk-al].
25 fn longest<'a>(str1: &'a str, str2: &'a str) -> &'a str {
26 if str1.len() > str2.len() {
34 [bk-no]: https://doc.rust-lang.org/book/appendix-02-operators.html#non-operator-symbols
35 [bk-al]: https://doc.rust-lang.org/nightly/edition-guide/rust-2018/ownership-and-lifetimes/the-anonymous-lifetime.html