rust/tests/ui/issues/issue-3447.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
573 B
Rust
Raw Normal View History

// run-pass
#![allow(dead_code)]
#![allow(non_snake_case)]
#![allow(non_camel_case_types)]
2013-10-23 03:49:18 -05:00
2013-12-31 17:46:27 -06:00
use std::cell::RefCell;
static S: &'static str = "str";
struct list<T> {
element: T,
2014-10-02 00:10:09 -05:00
next: Option<Box<RefCell<list<T>>>>
2012-10-15 14:00:32 -05:00
}
impl<T:'static> list<T> {
pub fn addEnd(&mut self, element: T) {
2012-10-15 14:00:32 -05:00
let newList = list {
element: element,
next: None
2012-10-15 14:00:32 -05:00
};
self.next = Some(Box::new(RefCell::new(newList)));
2012-10-15 14:00:32 -05:00
}
}
pub fn main() {
let ls = list {
element: S,
next: None
2012-10-15 14:00:32 -05:00
};
println!("{}", ls.element);
2012-10-15 14:00:32 -05:00
}