← All notes

Rust ownership and borrowing in five rules

Short answer

Rust manages memory through ownership rules the compiler checks, with no garbage collector and no runtime cost:

  1. Each value has an owner.
  2. There is one owner at a time.
  3. When the owner goes out of scope, the value is dropped. [S1]
fn len(s: &String) -> usize { s.len() } // borrows, caller keeps s

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted).

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Copyright (c) 2010 The Rust Project Developers. Sources: The Rust Project (The Rust Programming Language book), What is Ownership? - The Rust Programming Language, MIT OR Apache-2.0 (rust-lang/book); The Rust Project (The Rust Programming Language book), References and Borrowing - The Rust Programming Language, MIT OR Apache-2.0 (rust-lang/book).

Cite this

Permanent ID: iil:note:c5e5w64x

iinventedlight. 2026. "Rust ownership and borrowing in five rules." iinventedlight Library, iil:note:c5e5w64x, version of 2026-11-04. https://iinventedlight.com/library/notes/rust-ownership-borrowing/. License: CC-BY-4.0.

@misc{iil_note_c5e5w64x,
  author = {{iinventedlight}},
  title = {{Rust ownership and borrowing in five rules}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-04},
  url = {https://iinventedlight.com/library/notes/rust-ownership-borrowing/},
  note = {Permanent ID iil:note:c5e5w64x. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.

For language models and agents: start at /llms.txt. This page in Markdown: /library/notes/rust-ownership-borrowing.md.