summaryrefslogtreecommitdiffstats
path: root/tests/ui/traits/object-does-not-impl-trait.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/traits/object-does-not-impl-trait.rs')
-rw-r--r--tests/ui/traits/object-does-not-impl-trait.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/ui/traits/object-does-not-impl-trait.rs b/tests/ui/traits/object-does-not-impl-trait.rs
new file mode 100644
index 000000000..b3b679813
--- /dev/null
+++ b/tests/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() {}