---
title: "What is &mut *x (reborrow) in Rust, and why does it freeze the original reference?"
description: "A reborrow duplicates the reference, not the data, and freezes the original for its duration. What &mut *x really does."
url: "https://mayorana.ch/en/blog/reborrow-rust"
language: "en"
date: "2026-03-31"
author: "Mohamed Bennekrouf"
tags:
  - "rust"
  - "memory"
  - "borrowing"
  - "ownership"
  - "borrow-checker"
fr_version: "https://mayorana.ch/fr/blog/reborrow-rust.md"
---

# What is &mut *x (reborrow) in Rust, and why does it freeze the original reference?

In Rust, the expression `&mut *x` is called a **reborrow**. It lets you create a new mutable reference from an existing one without consuming it — something the [borrow checker](https://mayorana.ch/en/blog/borrowing-rules-rust) would normally block. Understanding reborrows is key to writing idiomatic Rust when dealing with mutable references across function boundaries.

<div class="svg-container" style="margin:2rem 0;">
<svg class="mm13-fig" viewBox="0 0 800 220" width="100%" style="height:auto;max-width:780px;display:block;margin:0 auto;" role="img" aria-label="Timeline of a reborrow: x is active, then y reborrows and x freezes, then y drops and x becomes active again">
<!-- style -->
<style>
.mm13-fig{--bg:#f8fafc;--box:#ffffff;--tx:#1e293b;--mut:#64748b;--ln:#cbd5e1;--ac:#FF6B00}
:root.dark .mm13-fig,[data-theme="dark"] .mm13-fig{--bg:#0f172a;--box:#1e293b;--tx:#f8fafc;--mut:#94a3b8;--ln:#475569}
.mm13-fig .box{fill:var(--box);stroke:var(--ln);stroke-width:1.5}
.mm13-fig .boxac{fill:var(--box);stroke:var(--ac);stroke-width:2}
.mm13-fig .frozen{fill:var(--box);stroke:var(--ln);stroke-width:1.5;stroke-dasharray:4 3;opacity:0.6}
.mm13-fig .ti{fill:var(--tx);font:700 14px ui-sans-serif,system-ui,sans-serif}
.mm13-fig .tx{fill:var(--tx);font:600 12px ui-sans-serif,system-ui,sans-serif}
.mm13-fig .mut{fill:var(--mut);font:11px ui-sans-serif,system-ui,sans-serif}
.mm13-fig .ln{stroke:var(--ln);stroke-width:1.5;fill:none}
</style>
<!-- defs -->
<defs>
<marker id="mm13arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,0L10,5L0,10z" fill="var(--ln)"/></marker>
</defs>
<!-- title -->
<text x="400" y="24" text-anchor="middle" class="ti">Lifetime of &amp;mut *x — the freeze window</text>
<!-- stage 1 -->
<rect x="40" y="44" width="200" height="46" rx="6" class="boxac"/>
<text x="140" y="72" text-anchor="middle" class="tx">x active</text>
<path d="M240,67 L268,67" class="ln" marker-end="url(#mm13arrow)"/>
<!-- stage 2 -->
<rect x="270" y="44" width="240" height="46" rx="6" class="frozen"/>
<text x="390" y="66" text-anchor="middle" class="tx">x frozen</text>
<text x="390" y="82" text-anchor="middle" class="mut">y = &amp;mut *x is active</text>
<path d="M510,67 L538,67" class="ln" marker-end="url(#mm13arrow)"/>
<!-- stage 3 -->
<rect x="540" y="44" width="220" height="46" rx="6" class="boxac"/>
<text x="650" y="66" text-anchor="middle" class="tx">x active again</text>
<text x="650" y="82" text-anchor="middle" class="mut">y dropped, freeze lifted</text>
<!-- caption -->
<text x="40" y="130" class="mut">Only one of x, y is ever usable at a time — the borrow checker enforces the boundary</text>
<rect x="40" y="150" width="720" height="4" rx="2" fill="var(--ln)"/>
<text x="60" y="188" class="mut">t0: let x = &amp;mut value;</text>
<text x="330" y="188" class="mut">t1: let y = &amp;mut *x;</text>
<text x="610" y="188" class="mut">t2: drop(y);</text>
</svg>
</div>

## Breaking Down `&mut *x`

Given a variable `x` of type `&mut T`, the expression `&mut *x` does two things in sequence:

- `*x` — dereferences `x` to access the underlying value of type `T`.
- `&mut` — takes a new mutable reference to that value.

The result is a new mutable reference `y` pointing to the **same data** as `x`, but as a distinct reference with its own lifetime.

```rust
fn main() {
    let mut value = 42;
    let x: &mut i32 = &mut value;

    let y: &mut i32 = &mut *x; // reborrow: y points to the same data as x
    *y += 1;

    // y is no longer used past this point, so x is accessible again
    println!("{}", x); // prints 43
}
```

## The "Freeze" Mechanism

This is the crucial part: **while `y` is alive, `x` is frozen**.

The borrow checker enforces that you cannot have two active mutable references to the same data simultaneously. During a reborrow:

- `y` is the **active** mutable reference — you can use it to read or modify the value.
- `x` is **frozen** — it exists, but it cannot be used until `y` goes out of scope.
- Once `y`'s scope ends, the freeze is lifted and `x` becomes usable again.

```rust
fn main() {
    let mut value = String::from("hello");
    let x = &mut value;

    let y = &mut *x; // x is now frozen
    y.push_str(", world");

    // println!("{}", x); // ERROR: x is frozen while y is live

    drop(y); // y goes out of scope, freeze is lifted
    println!("{}", x); // OK: prints "hello, world"
}
```

This is not a workaround for Rust's safety rules — it is how those rules work. The borrow checker tracks the lifetimes of both `x` and `y` and guarantees they are never used simultaneously.

## Why Not Just Pass `x` Directly?

If you pass `x` directly to a function expecting `&mut T`, Rust moves the borrow into the function. Without reborrowing, you would lose access to `x` for the duration of the call.

<div class="svg-container" style="margin:2rem 0;">
<svg class="mm13b-fig" viewBox="0 0 800 260" width="100%" style="height:auto;max-width:780px;display:block;margin:0 auto;" role="img" aria-label="Without reborrowing the first call would consume x and the second would fail, but the compiler inserts an implicit reborrow so the borrow returns and the second call compiles">
<!-- style -->
<style>
.mm13b-fig{--bg:#f8fafc;--box:#ffffff;--tx:#1e293b;--mut:#64748b;--ln:#cbd5e1;--ac:#FF6B00;--bad:#e11d48}
:root.dark .mm13b-fig,[data-theme="dark"] .mm13b-fig{--bg:#0f172a;--box:#1e293b;--tx:#f8fafc;--mut:#94a3b8;--ln:#475569}
.mm13b-fig .panel{fill:none;stroke:var(--ln);stroke-width:1.5}
.mm13b-fig .box{fill:var(--box);stroke:var(--ln);stroke-width:1.5}
.mm13b-fig .boxac{fill:var(--box);stroke:var(--ac);stroke-width:2}
.mm13b-fig .boxbad{fill:var(--box);stroke:var(--bad);stroke-width:2;stroke-dasharray:4 3}
.mm13b-fig .ti{fill:var(--tx);font:700 13px ui-sans-serif,system-ui,sans-serif;text-anchor:middle}
.mm13b-fig .tx{fill:var(--tx);font:600 12px ui-sans-serif,system-ui,sans-serif;text-anchor:middle}
.mm13b-fig .mut{fill:var(--mut);font:11px ui-sans-serif,system-ui,sans-serif;text-anchor:middle}
.mm13b-fig .bad{fill:var(--bad);font:600 12px ui-sans-serif,system-ui,sans-serif;text-anchor:middle}
.mm13b-fig .ln{stroke:var(--ln);stroke-width:1.5;fill:none}
.mm13b-fig .lnbad{stroke:var(--bad);stroke-width:1.5;fill:none;stroke-dasharray:4 3}
</style>
<!-- defs -->
<defs>
<marker id="mm13b-arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,0L10,5L0,10z" fill="var(--ln)"/></marker>
<marker id="mm13b-arrowbad" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,0L10,5L0,10z" fill="var(--bad)"/></marker>
</defs>
<!-- left panel: hypothetical move -->
<rect x="20" y="14" width="370" height="212" rx="8" class="panel"/>
<text x="205" y="36" class="ti">If the borrow were moved in</text>
<rect x="55" y="52" width="300" height="34" rx="5" class="box"/>
<text x="205" y="74" class="tx">let x = &amp;mut value;</text>
<path d="M205,86 L205,100" class="ln" marker-end="url(#mm13b-arrow)"/>
<rect x="55" y="100" width="300" height="34" rx="5" class="box"/>
<text x="205" y="122" class="tx">add_one(x) — x moved into fn</text>
<path d="M205,134 L205,148" class="lnbad" marker-end="url(#mm13b-arrowbad)"/>
<rect x="55" y="148" width="300" height="34" rx="5" class="boxbad"/>
<text x="205" y="170" class="bad">add_one(x) again → use after move</text>
<text x="205" y="206" class="mut">one call would consume the reference for good</text>
<!-- right panel: actual reborrow -->
<rect x="410" y="14" width="370" height="212" rx="8" class="panel"/>
<text x="595" y="36" class="ti">What the compiler actually does</text>
<rect x="445" y="52" width="300" height="34" rx="5" class="box"/>
<text x="595" y="74" class="tx">let x = &amp;mut value;</text>
<path d="M595,86 L595,100" class="ln" marker-end="url(#mm13b-arrow)"/>
<rect x="445" y="100" width="300" height="34" rx="5" class="boxac"/>
<text x="595" y="118" class="tx">add_one(&amp;mut *x) — inserted for you</text>
<text x="595" y="130" class="mut">borrow lasts only for the call</text>
<path d="M595,134 L595,148" class="ln" marker-end="url(#mm13b-arrow)"/>
<rect x="445" y="148" width="300" height="34" rx="5" class="box"/>
<text x="595" y="170" class="tx">add_one(x) again → OK, prints 2</text>
<text x="595" y="206" class="mut">the loan returns when the call returns</text>
<!-- footer -->
<text x="400" y="248" class="mut">NLL writes the &amp;mut *x for you — the explicit form is just this desugaring spelled out</text>
</svg>
</div>

```rust
fn add_one(n: &mut i32) {
    *n += 1;
}

fn main() {
    let mut value = 0;
    let x = &mut value;

    add_one(x);        // Rust implicitly reborrows x here as &mut *x
    add_one(x);        // x is still usable after the first call
    println!("{}", x); // prints 2
}
```

In modern Rust with **Non-Lexical Lifetimes (NLL)**, the compiler performs this reborrow implicitly when you pass a `&mut T` to a function. The explicit form `&mut *x` is what happens under the hood.

## Implicit vs Explicit Reborrow

| **Form** | **When Used** | **Example** |
|---|---|---|
| Implicit (`x`) | Passing `&mut T` to a function | `add_one(x)` → compiler inserts `&mut *x` |
| Explicit (`&mut *x`) | Complex scenarios requiring manual control | Method chaining, iterator adapters |

In most day-to-day Rust code, you never need to write `&mut *x` yourself. The NLL-aware borrow checker handles it. However, explicit reborrows are sometimes needed in:

- **Method chaining**: When calling a method that takes `&mut self` on a `&mut T`.
- **Iterator patterns**: When iterating over a mutable slice via a reference.
- **Older Rust code**: Where the borrow checker's inference is less sophisticated.
- **Trait implementations**: Where the compiler cannot infer the reborrow automatically.

## Reborrow vs Move

It is important not to confuse a reborrow with a move. A move would consume the original reference; a reborrow only temporarily suspends it.

```rust
fn consume(x: &mut i32) { *x += 1; }

fn main() {
    let mut v = 0;
    let x = &mut v;

    // This is a reborrow (x remains usable after the call):
    consume(&mut *x);
    println!("{}", x); // OK

    // This also works due to implicit reborrow:
    consume(x);
    println!("{}", x); // Also OK
}
```

## How it Compares to Raw Pointers and `unsafe`

| **Concept** | **Safety** | **How it Works** |
|---|---|---|
| `&mut *x` (reborrow) | Safe | Borrow checker enforces single-active-reference rule |
| `*mut T` (raw pointer) | Unsafe | No borrow checker guarantees; manual aliasing control |
| `UnsafeCell<T>` | Unsafe interior | Explicit opt-out from borrow rules |

Reborrows give you the flexibility of working with multiple reference-like handles at different stages of a computation, while staying entirely within Rust's safe memory model.

## The reborrow rules
`&mut *x` creates a new mutable reference pointing to the same data as `x`, without consuming `x`.

While the reborrow `y` is alive, `x` is frozen — the borrow checker prevents both from being used simultaneously.

Once `y` goes out of scope, the freeze is lifted and `x` is usable again.

Modern Rust performs reborrows implicitly when passing `&mut T` to functions — you rarely need to write `&mut *x` explicitly.

A reborrow is **not** a clone of the data — no memory is copied. Only the reference (a pointer) is duplicated, with its lifetime constrained by the borrow checker.

Reborrowing `x` into both `y` and `z` while both are still live is rejected, and for the same
reason the original rule exists: two live mutable paths to one value is exactly what
exclusivity forbids.
