Closed
Description
This code segfaults on Mac OS X 10.8.5 with Rust 0.9:
struct Number {
n: i64
}
impl ToStr for Number {
fn to_str( &self) -> ~str {
self.n.to_str()
}
}
struct List {
list: ~[~ToStr]
}
impl List {
fn push( &mut self, n: ~ToStr) {
self.list.push( n);
}
}
fn main() {
let n = ~Number{ n: 42 };
let mut l = ~List{ list: ~[] };
l.push( n);
println!( "n: {}", n.to_str());
}