Urgent.News

What's breaking now, across thousands of outlets.

Tech

Rust project goals: Immobile types and guaranteed destructors

Article URL: https://github.com/rust-lang/rust-project-goals/blob/main/src/2026/move-trait.md Comments URL: https://news.ycombinator.com/item?id=49152023 Points: 211 # Comments: 84

Rust aims to introduce new traits that clarify the capabilities of types, such as Move and Forget. Currently, Rust assumes all types can be moved and forgotten, but some types require these capabilities to be disabled. For instance, self-referential async futures cannot be safely moved, leading to complexity with Pin. Similarly, destructors for types like Transaction and scoped task handles need to run, but mem::forget makes this impossible.

Rust's new auto-traits will make these capabilities explicit, allowing types to opt out. The Move trait will encode immovability as a type property, while the Forget trait will let types opt out of being forgettable. This approach aims to simplify immovability compared to Pin and guarantee destructor execution, enabling patterns like safe scoped spawn for async.

The proposal doesn't address changing the Future trait or Project Goal 2025H2, which involves experimenting with Pin ergonomics. Ultimately, the goal is to deprecate Pin in Rust entirely.

Written by urgent.news from Hacker News Best's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

This story

This is one outlet's version. Read the fullest account.

Read the original at github.com →

More in Tech

More from Monday 3 August →