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.

➡️ Stable 0.7x Programming Languages
7,212
Comments
16
Years Active
5
Top Authors
#9651
Topic ID

Activity Over Time

2011
2
2012
21
2013
51
2014
208
2015
311
2016
318
2017
481
2018
396
2019
498
2020
650
2021
678
2022
846
2023
843
2024
797
2025
1,022
2026
90

Keywords

GC lang.org blog.rust doc.rust RefCell FWIW map.rs default.html github.com VM rust borrow checker reference memory lifetimes mutability arc lifetime rc

Sample Comments

zozbot234 May 5, 2024 View on HN

Rust does "borrow checking at runtime" with RefCell.

shortstuffsushi Apr 10, 2015 View on HN

Wouldn't the concept of borrowing avoid that issue in Rust though?

cpeterso Apr 24, 2019 View on HN

Rust's borrow checker is like compile-time reference counting. Same benefit, but no run-time cost.

FartyMcFarter Mar 19, 2019 View on HN

It seems that unsafe references were used, so the advantages of Rust appear to have been somewhat relinquished in this case.

zozbot234 Feb 3, 2024 View on HN

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?

ironhaven Oct 24, 2025 View on HN

The borrow checker better described as compile time rwlock with all possible deadlocks caught as compiler errors

Too May 17, 2018 View on HN

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.

jakear May 28, 2023 View on HN

You understand a central tenant of Rust is forbidding shared ownership?

gue5t May 11, 2015 View on HN

Could you describe some of the upsides of regions as compared to Rust-style lifetimes and borrowck?

dbaupp Jul 18, 2014 View on HN

Would the cognitive overhead of that be any less than lifetimes in Rust?