Why can’t rust code process borrow checking at compile time?
use std::cell::RefCell; use std::collections::VecDeque; struct TextEditor { content: String, history: RefCell<VecDeque<String>>, } impl TextEditor { fn new(initial_content: &str) -> TextEditor { TextEditor { content: initial_content.to_string(), history: RefCell::new(VecDeque::new()), } } fn edit(&mut self, new_content: &str) { self.history.borrow_mut().push_front(self.content.clone()); self.content = new_content.to_string(); } fn undo(&mut self) -> Result<(), String> { let mut history_borrow = self.history.borrow_mut(); if let Some(previous_content) […]