Skip to content
Opensource internals
  • Posts

Rust

How rustc Sorts Struct Fields by log2(Size) and Then Hides a Niche

Oct 21, 2026 5 min read Jay Hubbert

rustc’s field reordering sorts by log2(max(align,size)) to minimise padding, and its enum layout reserves the largest invalid-value hole so Option<&T> is one pointer.

RustInternalsCompilerLayoutAbiPerformance

Read more →

Merging Codegen Units by Overlap: How rustc Decides What Goes in the Same .o File

Oct 21, 2026 5 min read Jay Hubbert

rustc’s CGU partitioning places items by their characteristic DefId and then merges units by inlined-item overlap, which keeps duplicated inlined code to a minimum.

RustInternalsCompilerCodegenPerformance

Read more →

Drop Glue Gets Four Times the Budget: rustc's Monomorphisation Recursion Hack

Oct 21, 2026 5 min read Jay Hubbert

rustc’s monomorphiser divides the recursion depth by four for drop glue only, giving it four times the budget because drop glue is legitimately recursive through the type …

RustInternalsCompilerMonomorphizationPerformance

Read more →

Four Ways to Drop: How rustc Decides Whether a Value Needs a Drop Flag

Oct 21, 2026 5 min read Jay Hubbert

Drop elaboration in rustc classifies each drop as Dead, Static, Conditional or Open using two dataflow analyses; only the Conditional case needs a runtime drop flag, so most drops …

RustInternalsCompilerMirDropsPerformance

Read more →

The Call Graph From the Wrong MIR: How rustc's Inliner Avoids a Query Cycle

Oct 21, 2026 6 min read Jay Hubbert

rustc’s MIR inliner computes the call graph from mir_promoted rather than optimized_mir, so the query graph stays acyclic; the result is conservative but never deadlocks.

RustInternalsCompilerMirInliningIncrementalPerformance

Read more →

← Newer Page 5 of 8 Older →

© 2026 Jay Hubbert · Built with Hugo 0.168.0

RSS ·