Get the latest tech news

The inconceivable types of Rust: How to make self-borrows safe (2024)


One of the first things any Rust programmer learns is that you can’t pass an object and a reference to that object around at the same time. It’s impossible to do, even indirectly. This limitation has been the subject of countless questions on Stack Overflow and posts on Reddit and the Rust forums and anywhere else where Rust programmers might ask for help. It’s so well-known that most people treat it like an axiom, not just a limitation of Rust as it currently exists, but an inherent limitation of borrow checking in general.

None

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Rust

Rust

Photo of borrows

borrows

Photo of inconceivable types

inconceivable types

Related news:

News photo

Boa: A standard-conforming embeddable JavaScript engine written in Rust

News photo

A structural regular expression engine for Rust

News photo

Rust in Android: move fast and fix things