]> git.lizzy.rs Git - rust.git/blob - tests/ui/issues/issue-3447.rs
Rollup merge of #106752 - sulami:master, r=estebank
[rust.git] / tests / ui / issues / issue-3447.rs
1 // run-pass
2 #![allow(dead_code)]
3 #![allow(non_snake_case)]
4 #![allow(non_camel_case_types)]
5
6 use std::cell::RefCell;
7
8 static S: &'static str = "str";
9
10 struct list<T> {
11     element: T,
12     next: Option<Box<RefCell<list<T>>>>
13 }
14
15 impl<T:'static> list<T> {
16     pub fn addEnd(&mut self, element: T) {
17         let newList = list {
18             element: element,
19             next: None
20         };
21
22         self.next = Some(Box::new(RefCell::new(newList)));
23     }
24 }
25
26 pub fn main() {
27     let ls = list {
28         element: S,
29         next: None
30     };
31     println!("{}", ls.element);
32 }