There Is Life Before Main in Rust
15 points by mmastrac 2 days ago | 3 comments

smy20011 29 minutes ago
> This post is 100% human-written. Claude was used for feedback and to assist with the linker symbol diagram. Cursor was used for feedback and to ensure examples were compilable.

Love this, I hope every blog have the same disclaimer about how AI is used.

reply
rootnod3 54 seconds ago
If Claude gave feedback then it’s not really 100% human written is it?
reply
mmastrac 33 minutes ago
Author here, happy to answer any questions. I've been working on building some higher-level abstractions on link sections (specifically, link-time optimized collections like maps (1) and sorted slices (2)) and wanted to share the hard-fought knowledge from the last couple of months.

There's a decent amount of knowledge around pre-main work in Rust, but I think this is one of the first attempts to walk through mutable link sections, which open up a pretty wide world of optimization, IMO. Even without mutability, I figured there isn't nearly enough documentation on these approaches out there.

(1) https://docs.rs/scattered-collect/0.20.0/scattered_collect/m...

(2) https://docs.rs/scattered-collect/0.20.0/scattered_collect/s...

reply