TUESDAY, JUNE 16, 2026
gccrs
gccrs: Refactor CompileDrop and add DropBuilder
Refactoring in gccrs improves drop-related compilation by isolating drop logic.
This patch refactors the drop compilation logic in gccrs by introducing a new DropBuilder class and making Context a member of CompileDrop. This change isolates drop-specific APIs from the main compile context, improving modularity and maintainability.
In Details
The CompileDrop class in rust-compile-drop.cc now holds a Context member, and drop candidate management (note/peek operations) has been moved from Context to DropBuilder. This is a refactoring effort in the backend code generation for Rust, specifically concerning the handling of destructors and resource cleanup.
For Context
- DropBuilder
- A new class in gccrs responsible for managing and collecting drop candidates, isolating this logic from the main compile context.
- CompileDrop
- A class within gccrs that compiles the necessary code for dropping variables and resources.
- Context
- In the context of gccrs compilation, this likely refers to the compiler's internal state and environment during the compilation process.