Created
May 30, 2014 10:52
-
-
Save m10e/9a182cf60fd907a47999 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
System: | |
rustc 0.11.0-pre-nightly (022a7b3 2014-05-22 01:06:25 -0700) | |
host: x86_64-apple-darwin | |
Error: | |
main.rs:14:2: 14:7 error: mismatched types: expected `Box A` but found `~B` (expected trait A but found box) | |
main.rs:14 box B | |
^~~~~ | |
error: aborting due to previous error | |
// -------------------- main.rs | |
trait A { | |
fn do_stuff(&self); | |
} | |
struct B; | |
impl A for B { | |
fn do_stuff(&self) { | |
println!("Stuff."); | |
} | |
} | |
fn new_a() -> Box<A> { | |
box B | |
} | |
fn main() { | |
let a = new_a(); | |
a.do_stuff(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment