Simplify issue-4291 test

This commit is contained in:
Michael Wright 2019-09-01 07:55:29 +02:00
parent 88750f9ad7
commit 4458bef5d1
2 changed files with 11 additions and 13 deletions

View File

@ -63,20 +63,12 @@ impl X {
// Methods implementing traits must have matching lifetimes
mod issue4291 {
#[derive(Debug)]
pub struct Foo<'a>(&'a std::marker::PhantomData<u8>);
#[derive(Debug)]
pub struct Bar<'a: 'b, 'b>(Foo<'a>, &'b std::marker::PhantomData<u8>);
trait LT {
fn test<'a: 'b, 'b>(foo: &Foo<'a>, bar: &Bar<'a, 'b>);
trait BadTrait {
fn unused_lt<'a>(x: u8) {}
}
pub struct Baz;
impl LT for Baz {
fn test<'a: 'b, 'b>(_foo: &Foo, _bar: &Bar) {}
impl BadTrait for () {
fn unused_lt<'a>(_x: u8) {}
}
}

View File

@ -18,5 +18,11 @@ error: this lifetime isn't used in the function definition
LL | fn x<'a>(&self) {}
| ^^
error: aborting due to 3 previous errors
error: this lifetime isn't used in the function definition
--> $DIR/extra_unused_lifetimes.rs:67:22
|
LL | fn unused_lt<'a>(x: u8) {}
| ^^
error: aborting due to 4 previous errors