---
source: https://iinventedlight.com/library/notes/rust-rc-refcell.md
title: "Rc and RefCell interior mutability"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT OR Apache-2.0 (rust-lang/book and cited companions); prose restates cited source lines in own words"
license_family: rust-mit
attribution: "Summary by iinventedlight (AI-assisted). Sources: Rust book + Rust by Example Rc page (MIT OR Apache-2.0). Notices: The Rust Programming Language book (rust-lang/book): Copyright (c) 2010 The Rust Project Developers; MIT OR Apache-2.0, used under MIT (https://github.com/rust-lang/book/blob/main/LICENSE-MIT). Rust by Example (rust-lang/rust-by-example): Copyright (c) 2014 Jorge Aparicio; MIT OR Apache-2.0, used under MIT (https://github.com/rust-lang/rust-by-example/blob/master/LICENSE-MIT)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-09
status: published
approved_by: "Cole Withington, 2026-11-09 13:40 PT: \"Yes, publish all 15 Rust drafts\""
checked_on: 2026-11-09
as_of: 2026-11-09
confidence: medium
untested: "No Rust code was run for this note; only the fetched documentation pages were read."
category: coding-references
topic_area: "code-systems: Rust smart pointers"
tags: [rust, rc, refcell, interior-mutability]
client: Librarian
sources:
  - id: S1
    title: "Rc<T>, the Reference Counted Smart Pointer"
    publisher: The Rust Project (The Rust Programming Language book)
    url: https://doc.rust-lang.org/book/ch15-04-rc.html
    accessed: 2026-11-09
    license: "MIT OR Apache-2.0"
  - id: S2
    title: "RefCell<T> and Interior Mutability Pattern"
    publisher: The Rust Project (The Rust Programming Language book)
    url: https://doc.rust-lang.org/book/ch15-05-interior-mutability.html
    accessed: 2026-11-09
    license: "MIT OR Apache-2.0"
  - id: S3
    title: "Rc - Rust By Example"
    publisher: Rust by Example (rust-lang/rust-by-example)
    url: https://doc.rust-lang.org/rust-by-example/std/rc.html
    accessed: 2026-11-09
    license: "MIT OR Apache-2.0"
---
# Rc and RefCell interior mutability

**Answer:** `Rc` means reference counting: `Rc<T>` tracks how many handles point at a value. Some structures need multiple owners for one value.

## Interior mutability

`RefCell<T>` checks borrow rules at runtime. Interior mutability lets you mutate data behind what looks like an immutable reference.

`Rc` supports multiple ownership by counting references.

## Claims

- id: C1
  claim: Rc keeps track of references via reference counting.
  source: S1
  evidence: "abbreviation for reference counting. The Rc<T> type keeps track of the number of references to"
- id: C2
  claim: In some cases a single value might have multiple owners.
  source: S1
  evidence: "multiple owners. For example, in graph data structures, multiple edges might point to the same"
- id: C3
  claim: With RefCell, borrowing invariants are enforced at runtime.
  source: S2
  evidence: "With RefCell<T>, these invariants are enforced at runtime."
- id: C4
  claim: Interior mutability allows mutating data behind immutable references.
  source: S2
  evidence: "Interior mutability is a design pattern in Rust that allows you to mutate data even"

- id: C5
  claim: When multiple ownership is needed, Rc (Reference Counting) can be used.
  source: S3
  evidence: "When multiple ownership is needed, Rc(Reference Counting) can be used."

## Sources

- [S1] Rc<T>, the Reference Counted Smart Pointer. The Rust Project (The Rust Programming Language book). https://doc.rust-lang.org/book/ch15-04-rc.html . License: MIT OR Apache-2.0. Accessed 2026-11-09.
- [S2] RefCell<T> and Interior Mutability Pattern. The Rust Project (The Rust Programming Language book). https://doc.rust-lang.org/book/ch15-05-interior-mutability.html . License: MIT OR Apache-2.0. Accessed 2026-11-09.

- [S3] Rc - Rust By Example. Rust by Example (rust-lang/rust-by-example). https://doc.rust-lang.org/rust-by-example/std/rc.html . License: MIT OR Apache-2.0. Accessed 2026-11-09.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources and notices: The Rust Programming Language book (rust-lang/book): Copyright (c) 2010 The Rust Project Developers; MIT OR Apache-2.0, used under MIT (https://github.com/rust-lang/book/blob/main/LICENSE-MIT). Rust by Example (rust-lang/rust-by-example): Copyright (c) 2014 Jorge Aparicio; MIT OR Apache-2.0, used under MIT (https://github.com/rust-lang/rust-by-example/blob/master/LICENSE-MIT). Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
