Back to GNU Compiler Collection (GCC)
GSoC 2026

Add infrastructure to handle the "Drop" trait

gccrs still lacks support for Rust’s Drop trait, which is a core part of Rust’s resource management model. Without it, values that require cleanup cannot be handled correctly at scope exit, which makes gccrs incomplete with respect to important Rust semantics. This project proposes an incremental implementation of Drop support in gccrs, starting from a narrow and testable subset rather than attempting full drop elaboration at once. The first stage focuses on scope-exit destructor insertion for simple non-generic local variables using existing backend cleanup machinery. From there, the implementation will be extended to support multiple locals, correct reverse drop order (LIFO), and, if feasible, initial nested-scope cleanup. More advanced cases such as moved values, temporaries, partially initialized values, and generic Drop will be treated as later-stage or stretch work. The main deliverables are: an initial implementation of scope-exit Drop support for a restricted subset of local variables, support for correct LIFO drop ordering, regression tests covering the supported behavior, and documentation describing the implementation approach, supported subset, and current limitations.

Project details

Contributor

Janet Chien

Mentors

Not available

Technologies

Not listed in the archive