Rust Borrow Checker
Comments discuss Rust's borrow checker, ownership semantics, lifetimes, and related features like RefCell, Rc, and Arc, comparing them to runtime reference counting and debating their benefits, costs, and limitations for memory safety.
Activity Over Time
Top Contributors
Keywords
Sample Comments
Rust does "borrow checking at runtime" with RefCell.
Wouldn't the concept of borrowing avoid that issue in Rust though?
Rust's borrow checker is like compile-time reference counting. Same benefit, but no run-time cost.
It seems that unsafe references were used, so the advantages of Rust appear to have been somewhat relinquished in this case.
Isn't that why Rc and Arc exist in Rust? So that you can deal with situations where you don't know the object lifecycle at compile time?
The borrow checker better described as compile time rwlock with all possible deadlocks caught as compiler errors
Does rust have something like shared pointers? In c++ that's usually a quite easy way to bail out of the cognitive burden of understanding complex lifetimes.
You understand a central tenant of Rust is forbidding shared ownership?
Could you describe some of the upsides of regions as compared to Rust-style lifetimes and borrowck?
Would the cognitive overhead of that be any less than lifetimes in Rust?