3d4ef74c9b
This lets you use class A as if it had type B if A implements B, and A and B are in different crates from your own. Closes #2285
19 lines
374 B
Rust
19 lines
374 B
Rust
// xfail-fast
|
|
// aux-build:cci_class_cast.rs
|
|
use cci_class_cast;
|
|
import cci_class_cast::kitty::*;
|
|
import to_str::*;
|
|
import to_str::to_str;
|
|
|
|
fn print_out<T: to_str>(thing: T, expected: str) {
|
|
let actual = thing.to_str();
|
|
#debug("%s", actual);
|
|
assert(actual == expected);
|
|
}
|
|
|
|
fn main() {
|
|
let nyan : to_str = cat(0u, 2, "nyan") as to_str;
|
|
print_out(nyan, "nyan");
|
|
}
|
|
|