summaryrefslogtreecommitdiffstats
path: root/src/test/ui/traits/matching-lifetimes.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/traits/matching-lifetimes.rs')
-rw-r--r--src/test/ui/traits/matching-lifetimes.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/ui/traits/matching-lifetimes.rs b/src/test/ui/traits/matching-lifetimes.rs
new file mode 100644
index 000000000..1430dc655
--- /dev/null
+++ b/src/test/ui/traits/matching-lifetimes.rs
@@ -0,0 +1,20 @@
+// Tests that the trait matching code takes lifetime parameters into account.
+// (Issue #15517.)
+
+struct Foo<'a,'b> {
+ x: &'a isize,
+ y: &'b isize,
+}
+
+trait Tr : Sized {
+ fn foo(x: Self) {}
+}
+
+impl<'a,'b> Tr for Foo<'a,'b> {
+ fn foo(x: Foo<'b,'a>) {
+ //~^ ERROR method not compatible with trait
+ //~^^ ERROR method not compatible with trait
+ }
+}
+
+fn main(){}