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
574 B
Rust
Raw Normal View History

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