Get the latest tech news

A surprising enum size optimization in the Rust compiler


Personal website of James Fennell

A quick search reveals that this number is exactly one bigger than the largest valid Unicode code point. My understanding was that Rust doesn’t perform any more optimizations, so I was pleasantly surprised recently when I found one. Already we see something weird happening: Rust has chosen to use the tag number 2 for Outer::C instead of starting from 0 like it did for Inner::A.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Rust

Rust

Photo of rust compiler

rust compiler

Related news:

News photo

Photon: Rust/WebAssembly image processing library

News photo

A year of Rust in ClickHouse

News photo

Rust-Written Redox OS Makes USB 3.x Improvements, Async NVMe Driver Support