Current State
We have successfully established the fundamental infrastructure required to support the alloc crate within gccrs.
Note
The features registered as temporary stubs in the previous section represent architectural boundaries. Rather than waiting for the entire compiler infrastructure to catch up, we utilized these stubs to unblock development and make independent progress. Once those upstream compiler components mature, substituting these stubs with full implementations will be straightforward.
The Test Suite Strategy
Currently, we have an automated test suite for the alloc crate. However, we cannot yet compile the crate end-to-end.
The upstream core test suite is currently capable of compiling up to the AST lowering phase. To keep our work strictly synchronized with the compiler’s current capabilities and avoid upstream panics, the alloc test suite is configured to successfully compile up to the name resolution phase.
The “Mock Core” Architecture
To satisfy alloc’s heavy dependency on core without being blocked by the compiler’s incomplete standard library support, we inject a custom mock core directly into the test suite. This mock core is defined as a submodule and provides just enough structure to pass the required compiler phases.
Here is a high-level representation of how the alloc test suite and the mock core are architected:
gcc/testsuite/rust/alloc <-- alloc testsuite
├── alloc
│ └── src
│ ├── alloc/ ┌───────────────────────────────────┐
│ ├── alloc.rs │152│ . │
│ ├── borrow.rs │153│ . │
│ ├── boxed.rs │154│ │
│ ├── collections/ │155│ #[path = "../../core.rs"] │
│ ├── fmt.rs │156│ pub mod core; <───────────────┼───┐
│ ├── lib.rs ──────────────┤ │ . │ │
│ ├── macros.rs │157│ #[path = "../../prelude.rs"] │ │
│ ├── prelude/ │158│ pub mod gccrs_core_prelude; <─┼───┼────┐
│ ├── raw_vec/ │159│ │ │ │
│ ├── raw_vec.rs │160│ . │ │ │
│ ├── rc/ │161│ . │ │ │
│ ├── rc.rs └───────────────────────────────────┘ │ │
│ ├── slice.rs │ │
│ ├── str.rs │ │
│ ├── string.rs │ │
│ ├── sync/ │ │
│ ├── sync.rs │ │
│ ├── task.rs │ │
│ ├── tests.rs │ │
│ └── vec.rs │ │
├── alloc.exp │ │
├── core.rs ────────────────────────────────────────────────────────────┘ │
└── prelude.rs ──────────────────────────────────────────────────────────────┘