rust/tests/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
346 B
Rust
Raw Normal View History

2018-05-03 18:43:28 -04:00
// Test that we DO NOT warn for a lifetime used twice in an impl method and
// header.
2018-05-19 01:13:53 +03:00
#![deny(single_use_lifetimes)]
2018-05-03 18:43:28 -04:00
#![allow(dead_code)]
#![allow(unused_variables)]
struct Foo<'f> {
data: &'f u32
}
2018-05-03 18:43:28 -04:00
impl<'f> Foo<'f> { //~ ERROR `'f` only used once
fn inherent_a<'a>(&self, data: &'a u32) -> &'a u32{
data
}
}
fn main() { }