Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Missing Pieces

When the project started, the goal was clear: compile the alloc crate. However, alloc is a massive codebase heavily coupled with core. To understand exactly what gccrs was missing, we needed to map out the crate’s internal dependencies and reverse-engineer its requirements from the bottom up.

The Dependency Analysis Methodology

Instead of blindly feeding the entire crate to the compiler and chasing a wall of errors, I performed a strict static analysis of the alloc source code.

Mapping core Usage: I scanned every file in alloc (e.g., alloc.rs, boxed.rs, vec.rs) to extract all core:: import statements, macros, lang items, and built-in attributes.

Grouping by Logical Chunks: alloc contains deeply intertwined files. By analyzing internal dependencies (e.g., vec.rs relies on raw_vec.rs, which relies on alloc.rs), I divided the entire crate into 5 logical, manageable chunks.

Filtering Supported Features: I cross-referenced the extracted list against the current gccrs codebase to filter out features that were already supported (like standard traits, core::fmt, basic macros, and standard attributes).

What remained was the exact recipe of technical gaps blocking the compilation of alloc.

The Missing Pieces: What We Found

We categorized these missing pieces into three major domains:

Missing Lang Items

alloc_layout, box_free, coerce_unsized, dispatch_from_dyn, drop, drop_in_place, exchange_malloc, future_trait, generator, generator_state, maybe_uninit, oom, owned_box, pending, pin, poll, range_inclusive_new, ready, unsize, unpin, unsafe_cell,

Missing Intrinsics

arith_offset, assert_zero_valid, min_align_of, min_align_of_val, size_of_val, write_bytes

Missing Attributes

needs_allocator, rustc_allocator, rustc_allocator_nounwind, rustc_conversion_suggestion, rustc_std_internal_symbol

Missing Infrastructure

Dynamic Sized Types (DSTs): Slices ([T]) and Trait Objects (dyn Trait) don’t have a known size at compile time. This is supported, but it needs to be extended to include ADTs.

Fat Pointers & Vtables: Pointers to DSTs require two machine words (data address + size/vtable address). The compiler’s vtable generation needed a major refactor.

Unsized Coercions: The ability to automatically coerce a thin pointer to an array (&[i32; 3]) into a fat pointer to a slice (&[i32]), or to a trait object.


If you are a compiler developer and want to see the exact file-by-file raw data, dependency mappings, and how the crate was grouped, just continue to the next page.

Current Status & Progress: Skip the raw data and see what we actually accomplished.