Spot the bug in the Rc tree

from Box, Rc and Arc
Rust 1.98 intermediate 4 min 1 issue to find

Find why dropping the external root may not destroy this tree.

Rust
use std::cell::RefCell;
use std::rc::Rc;

struct Node {
    parent: RefCell<Option<Rc<Node>>>,
    children: RefCell<Vec<Rc<Node>>>,
}

fn attach(parent: &Rc<Node>, child: &Rc<Node>) {
    *child.parent.borrow_mut() = Some(Rc::clone(parent));
    parent.children.borrow_mut().push(Rc::clone(child));
}
Open in playground
Report an error