Make class-cast-to-trait compile (not sure why this worked before)

This commit is contained in:
Tim Chevalier 2012-10-27 17:22:01 -07:00
parent 64193a9eb8
commit 5e5ea04608

View File

@ -7,7 +7,7 @@ struct cat {
priv mut meows : uint,
mut how_hungry : int,
name : str,
name : ~str,
}
impl cat {
@ -33,14 +33,14 @@ impl cat : noisy {
priv impl cat {
fn meow() {
error!("Meow");
self.meows += 1u;
if self.meows % 5u == 0u {
self.meows += 1;
if self.meows % 5 == 0 {
self.how_hungry += 1;
}
}
}
fn cat(in_x : uint, in_y : int, in_name: str) -> cat {
fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
cat {
meows: in_x,
how_hungry: in_y,
@ -49,6 +49,6 @@ fn cat(in_x : uint, in_y : int, in_name: str) -> cat {
}
fn main() {
let nyan : noisy = cat(0u, 2, "nyan") as noisy;
let nyan : noisy = cat(0, 2, ~"nyan") as noisy;
nyan.eat();
}