2015-12-06 21:36:22 +00:00
|
|
|
#![feature(plugin)]
|
|
|
|
#![plugin(clippy)]
|
|
|
|
#![allow(unused, dead_code, needless_lifetimes)]
|
|
|
|
#![deny(unused_lifetimes)]
|
|
|
|
|
|
|
|
fn empty() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn used_lt<'a>(x: &'a u8) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn unused_lt<'a>(x: u8) { //~ ERROR this lifetime
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fn unused_lt_transitive<'a, 'b: 'a>(x: &'b u8) { //~ ERROR this lifetime
|
|
|
|
// 'a is useless here since it's not directly bound
|
|
|
|
}
|
|
|
|
|
|
|
|
fn lt_return<'a, 'b: 'a>(x: &'b u8) -> &'a u8 {
|
|
|
|
panic!()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn lt_return_only<'a>() -> &'a u8 {
|
|
|
|
panic!()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn unused_lt_blergh<'a>(x: Option<Box<Send+'a>>) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
trait Foo<'a> {
|
|
|
|
fn x(&self, a: &'a u8);
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'a> Foo<'a> for u8 {
|
|
|
|
fn x(&self, a: &'a u8) {
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2015-12-10 16:44:12 +00:00
|
|
|
|
2016-05-17 21:25:20 +00:00
|
|
|
struct Bar;
|
|
|
|
|
|
|
|
impl Bar {
|
|
|
|
fn x<'a>(&self) {} //~ ERROR this lifetime
|
|
|
|
}
|
|
|
|
|
2015-12-10 16:44:12 +00:00
|
|
|
// test for #489 (used lifetimes in bounds)
|
|
|
|
pub fn parse<'a, I: Iterator<Item=&'a str>>(_it: &mut I) {
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
pub fn parse2<'a, I>(_it: &mut I) where I: Iterator<Item=&'a str>{
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
|
2016-01-14 18:27:24 +00:00
|
|
|
struct X { x: u32 }
|
|
|
|
|
|
|
|
impl X {
|
|
|
|
fn self_ref_with_lifetime<'a>(&'a self) {}
|
|
|
|
fn explicit_self_with_lifetime<'a>(self: &'a Self) {}
|
|
|
|
}
|
|
|
|
|
2015-12-06 21:36:22 +00:00
|
|
|
fn main() {
|
|
|
|
|
|
|
|
}
|