Skip to content
Quiz · Smart pointers · lesson 6 of 6

Quiz — two borrow_mut

What happens when this program is built and run?

Rust
use std::cell::RefCell;

fn main() {
    let c = RefCell::new(1);
    let mut a = c.borrow_mut();
    *a += 1;
    let mut b = c.borrow_mut();
    *b += 1;
    println!("{b}");
}