Created
October 17, 2012 19:15
-
-
Save erickt/3907509 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
test.rs:27:12: 27:13 error: mismatched types: expected `&/T` but found `@T` (trait storage differs: expected & but found @) | |
test.rs:27 print_t(t); | |
^ | |
error: aborting due to previous error |
This file contains hidden or 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
trait T { | |
fn print(&self); | |
} | |
struct S { | |
s: int, | |
} | |
impl S: T { | |
fn print(&self) { | |
io::println(fmt!("%?", self)); | |
} | |
} | |
fn print_t(t: &T) { | |
t.print(); | |
} | |
fn print_s(s: &S) { | |
s.print(); | |
} | |
fn main() { | |
let s: @S = @S { s: 5 }; | |
print_s(s); | |
let t: @T = s as @T; | |
print_t(t); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment