Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumRustRc<RefCell<T>> combosSingle-choice MCQ

This program compiles but panics at runtime. What causes the panic?

use std::rc::Rc; use std::cell::RefCell; fn main() { let cell = Rc::new(RefCell::new(10)); let r = cell.borrow(); *cell.borrow_mut() += 1; println!("{}", *r); }