Hacker News·4 min read·hard

Rust project goals: Immobile types and guaranteed destructors

P
paavohtl
Rust project goals: Immobile types and guaranteed destructors
AI Summary

The Rust programming language team is proposing new traits to allow types to opt out of being moved or forgotten. This change aims to simplify the handling of self-referential types and ensure destructors run reliably, particularly for async programming and kernel development.

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.

Continue reading on Headlinne

Create a free account to read the full article.

Read full article →
technologyscience

Get the full story

Sign up for Headlinne to unlock AI insights, political bias analysis, and your personalized news feed.

Create free account

Already have an account? Sign in