Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumRustCell vs RefCellSingle-choice MCQ

Two simultaneous immutable borrows then a mutable borrow are attempted on a RefCell at runtime. What is the observable behavior?

use std::cell::RefCell; fn main() { let rc = RefCell::new(0); let a = rc.borrow(); let b = rc.borrow(); let c = rc.borrow_mut(); println!("{} {} {}", a, b, c); }