about summary refs log tree commit diff
path: root/tests/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.rs')
-rw-r--r--tests/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.rs b/tests/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.rs
new file mode 100644
index 00000000000..afd47f71c2c
--- /dev/null
+++ b/tests/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.rs
@@ -0,0 +1,31 @@
+#[derive(Default, PartialEq)]
+struct Foo<T> {
+    bar: Box<[T]>,
+}
+
+trait Bar {
+    fn foo(&self) {}
+}
+
+impl<T: Default + Bar> Bar for Foo<T> {}
+
+impl<T> Foo<T> {
+    fn bar(&self) {
+        self.foo();
+        //~^ ERROR the method
+    }
+}
+
+struct Fin<T> where T: Bar {
+    bar: Box<[T]>,
+}
+
+impl<T: Default + Bar> Bar for Fin<T> {}
+
+impl<T: Bar> Fin<T> {
+    fn bar(&self) {
+        self.foo();
+        //~^ ERROR the method
+    }
+}
+fn main() {}