diff options
Diffstat (limited to 'tests/ui/lifetimes/lifetime-mismatch-between-trait-and-impl.rs')
-rw-r--r-- | tests/ui/lifetimes/lifetime-mismatch-between-trait-and-impl.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/ui/lifetimes/lifetime-mismatch-between-trait-and-impl.rs b/tests/ui/lifetimes/lifetime-mismatch-between-trait-and-impl.rs new file mode 100644 index 000000000..2ce1a0f45 --- /dev/null +++ b/tests/ui/lifetimes/lifetime-mismatch-between-trait-and-impl.rs @@ -0,0 +1,12 @@ +trait Foo { + fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32; +} + +impl Foo for () { + fn foo<'a>(x: &'a i32, y: &'a i32) -> &'a i32 { + //~^ ERROR `impl` item signature doesn't match `trait` item signature + if x > y { x } else { y } + } +} + +fn main() {} |