rust/tests/ui/traits/object-does-not-impl-trait.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

9 lines
255 B
Rust
Raw Normal View History

// Test that an object type `Box<Foo>` is not considered to implement the
// trait `Foo`. Issue #5087.
2015-04-18 05:12:20 +00:00
trait Foo {}
fn take_foo<F:Foo>(f: F) {}
2019-05-28 18:46:13 +00:00
fn take_object(f: Box<dyn Foo>) { take_foo(f); }
//~^ ERROR `Box<dyn Foo>: Foo` is not satisfied
fn main() {}