Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trait A {}
- trait B: A {}
- struct C;
- impl A for C {}
- impl B for C {}
- fn foo(v: Box<A>) {}
- fn main() {
- let c = C;
- let b: Box<B> = Box::new(c);
- foo(b); // Compile error, wrong type : Expected Box<A>, got
- // Box<B>
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement