2018-05-03 18:43:28 -04:00
|
|
|
// Test that we DO NOT warn when lifetime name is used only
|
|
|
|
// once in a fn return type -- using `'_` is not legal there,
|
|
|
|
// as it must refer back to an argument.
|
|
|
|
//
|
|
|
|
// (Normally, using `'static` would be preferred, but there are
|
|
|
|
// times when that is not what you want.)
|
2019-06-12 17:56:51 +03:00
|
|
|
|
2020-10-24 19:22:53 -05:00
|
|
|
// check-pass
|
2019-06-12 17:56:51 +03:00
|
|
|
|
|
|
|
#![deny(single_use_lifetimes)]
|
2018-05-03 18:43:28 -04:00
|
|
|
|
2020-10-24 19:22:53 -05:00
|
|
|
// OK: used only in return type
|
|
|
|
fn b<'a>() -> &'a u32 {
|
2018-05-03 18:43:28 -04:00
|
|
|
&22
|
|
|
|
}
|
|
|
|
|
2022-05-10 21:15:30 +02:00
|
|
|
pub trait Tfv<'a> {}
|
|
|
|
impl Tfv<'_> for () {}
|
|
|
|
|
|
|
|
// Do NOT lint if used in return type.
|
|
|
|
pub fn i<'a>() -> impl Tfv<'a> {}
|
|
|
|
|
2019-06-12 17:56:51 +03:00
|
|
|
fn main() {}
|