rust/src/test/run-pass/issue-3447.rs

26 lines
443 B
Rust
Raw Normal View History

2012-10-15 14:00:32 -05:00
// xfail-test
struct list<T> {
element: &self/T,
mut next: Option<@list<T>>
}
impl<T> list<T>{
fn addEnd(&self, element: &self/T) {
let newList = list {
element: element,
next: option::None
};
self.next = Some(@newList);
}
}
fn main() {
let s = @"str";
let ls: list<@str> = list {
element: &s,
next: option::None
};
io::println(*ls.element);
}