struct list_head {
struct list_head *next;
};
void f() {
struct list_head list = { &list };
}
compiles to:
#[derive(Default)]
pub struct list_head {
pub next: Value<Ptr<list_head>>,
}
pub fn f_0() {
let list: Value<list_head> = Rc::new(RefCell::new(list_head {
next: Rc::new(RefCell::new((list.as_pointer()))),
}));
}
which fails to build with:
error[E0425]: cannot find value `list` in this scope
--> src/main.rs:35:37
|
35 | next: Rc::new(RefCell::new((list.as_pointer()))),
| ^^^^ not found in this scope
compiles to:
which fails to build with: