summaryrefslogtreecommitdiffstats
path: root/src/test/ui/traits/object-does-not-impl-trait.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/traits/object-does-not-impl-trait.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/test/ui/traits/object-does-not-impl-trait.rs b/src/test/ui/traits/object-does-not-impl-trait.rs
new file mode 100644
index 000000000..b3b679813
--- /dev/null
+++ b/src/test/ui/traits/object-does-not-impl-trait.rs
@@ -0,0 +1,8 @@
+// Test that an object type `Box<Foo>` is not considered to implement the
+// trait `Foo`. Issue #5087.
+
+trait Foo {}
+fn take_foo<F:Foo>(f: F) {}
+fn take_object(f: Box<dyn Foo>) { take_foo(f); }
+//~^ ERROR `Box<dyn Foo>: Foo` is not satisfied
+fn main() {}