What Has Been Done?
We have made significant progress in bringing alloc support to gccrs. You can inspect all individual patches in detail in the Contributions Overview section.
Resolved Lang Items
exchange_malloc: Fully implemented. Resolves the allocation method called duringBoxheap allocation.owned_box: Fully implemented end-to-end for box expressions. This includes the underlying DST support, auto-dereferencing, and method dispatch logic.pin/unpin: Implemented the necessary auto-trait and negative trait implementation infrastructure. The actual pinning logic is handled by library code, so no further compiler magic was required.alloc_layout/oom: Supported (generates the necessary symbols).unsize: Fully supported.coerce_unsized: The backend code generation is fully functional. Currently, the type-checking phase relies on hardcoded compiler rules rather than being fully trait-based. This is a temporary measure; once thegccrstrait engine matures, delegating this check will be straightforward.dispatch_from_dyn: Partially implemented (currently supported specifically forBox).unsafe_cell: Supported. Essential for safe interior mutability.range_inclusive_new: Fully implemented. Successfully lowers the..=syntax sugar to theRangeInclusive::new()method.
Stubs & Unsupported Items:
maybe_uninit,box_free,drop,drop_in_place: Registered as stubs to allow compilation to proceed. (The drop-related items fall under the broader, ongoingDropimplementation scope).future_trait,ready,pending,poll,generator,generator_state: Registered as stubs because Async & Generators are not yet supported.
Resolved Intrinsics
min_align_of: Implemented (alignment calculation for statically sized types).size_of_val/min_align_of_val: Fully supported for both sized and dynamically sized types (DSTs). If the incoming type is a DST, the compiler successfully extracts the required size and alignment information from the fat pointer’s metadata.arith_offset: Implemented for safe pointer offset calculations without triggering undefined behavior.write_bytes: Implemented (lowers tomemsetin the backend).assert_zero_valid: Registered as a stub. It is meant to abort if the zero value is invalid for a given type, but currently acts as a no-op. See the corresponding PR for details.
Resolved Attributes
rustc_allocator/rustc_allocator_nounwind/rustc_std_internal_symbol: Fully implemented with proper symbol generation.needs_allocator/rustc_conversion_suggestion: Registered as temporary stubs to unblock the standard library parsing.
Resolved Infrastructure
- Dynamic Sized Types (DSTs): Support implemented and stabilized for slices and trait objects within the
alloccontext. - Fat Pointers & Vtables: The vtable generation and fat pointer layout mechanics were successfully refactored and implemented.
- Unsized Coercions: Functional, allowing seamless conversions between thin and fat pointers.
Note
For any missing element (lang item, intrinsic, attribute, etc.), a full implementation is always the primary priority. Even if a full implementation is completely blocked by infrastructure limitations, deciding to register it as a stub requires careful thought and discussion. If something is registered as a stub, you can be certain it is a deliberate and well-considered decision.