error[E0072]: recursive type `ListNode` has infinite size
--> $DIR/E0072.rs:1:1
|
-LL | struct ListNode { //~ ERROR has infinite size
+LL | struct ListNode {
| ^^^^^^^^^^^^^^^ recursive type has infinite size
LL | head: u8,
LL | tail: Option<ListNode>,
- | ---------------------- recursive without indirection
+ | ---------------- recursive without indirection
|
- = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `ListNode` representable
+help: insert some indirection to make `ListNode` representable
+ |
+LL | tail: Box<Option<ListNode>>,
+ | ^^^^ ^
+LL | tail: Rc<Option<ListNode>>,
+ | ^^^ ^
+LL | tail: &Option<ListNode>,
+ | ^
error: aborting due to previous error