mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-26 14:43:24 +00:00
Make class-cast-to-trait compile (not sure why this worked before)
This commit is contained in:
parent
64193a9eb8
commit
5e5ea04608
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user