Immobile types and guaranteed destructors
Metadata Point of contact @lcnr Status Accepted What and why Let types opt out of being moved or forgotten, enabling scoped spawn, async drop, and pin-by-default Timespan 2026-2027 Roadmap Just add async Roadmap Rust for Linux Tracking issue [#635] Other tracking issues [rust-lang/rust#149607] Zulip channel #t-lang/move-trait [types] champion @lcnr [lang] champion @jackh726
Summary
We propose to introduce new traits that describe what operations are possible on a type. Today Rust assumes all types can be moved (relocated in memory) and forgotten (via mem::forget ). We will introduce traits like Move and Forget that make these capabilities explicit, allowing types to opt out. This follows the precedent set by the Sized hierarchy work, which relaxes the assumption that all types have a compile-time-known size. We will implement MVPs in the compiler, write RFCs, and validate viability through real-world testing in the Linux Kernel.
Motivation
The status quo
Rust has historically assumed that all values can be moved (relocated in memory) and forgotten (via mem::forget , without running destructors). These assumptions are baked into the language: assignment moves values, and mem::forget is safe. But some types need to opt out of these capabilities:
Immobile types: A lot of async futures want to be self-referential, but self-referential types can't be safely moved. The current solution is Pin , which encodes immovability as a property of places rather than types. This leads to significant complexity. As The Safe Pinned Initialization Problem describes, Pin struggles to safely encode self-referential types in systems like the Linux kernel.
Guaranteed destructors: Some types need their destructors to run. A Transaction type might require commit() or rollback() before cleanup. A scoped task handle must join before the scope exits. But mem::forget is safe, so Rust can't guarantee destructors run. This blocks patterns like safe scoped spawn for async, where the spawned task borrows from the parent scope.
What we propose to do about it
... continue reading