Rust (language)

Borrow Checker

Rust doesn’t have a GC, it simply cleans up after itself. This is due to the borrow checker in Rust.
See this answer on SO.

Rust would know when the variable gets out of scope or its lifetime ends at compile time and thus insert the corresponding LLVM/assembly instructions to free the memory.

Any variable declared gets released outside it’s scope, unless it gets moved.


References:

  1. Rust’s Borrow Checker - https://doc.rust-lang.org/1.8.0/book/references-and-borrowing.html

Cateogory: [Tech]
Tags: [systems programming] [programming languages]