Ramblings of an aging IT geek
← Ramblings of an aging IT geek
news

rust 1.46 is out and i finally stopped fighting the borrow checker

A few notes on Rust 1.46 landing in late August 2020 and the const-fn improvements that quietly made a chunk of my code nicer.

A tech news headline scrolling past on a screen

Rust 1.46 dropped this week and it's all over my feeds, mostly for #[track_caller] stabilising, which is the sort of thing that sounds dull until the day a panic finally points at the line that called the broken function rather than the line buried three layers down in a helper. That alone is worth the upgrade.

The bit I actually cared about was the expanded const fn support. I've got a small parser that builds a lookup table at startup, and I'd been quietly resenting the fact that I couldn't make it a const. With 1.46 letting you use control flow in const contexts, if, match, loops, a decent slice of it moved to compile time and the runtime init just went away. Not a headline feature. Just one of those small releases where something that annoyed you for a year stops annoying you.

I upgraded with rustup update, the build went green first try, and I went and made a coffee. That's the whole story, and after a few years of language churn elsewhere, a release this calm is its own kind of good news.