gccrs-final-report
Weekly Updates
A week-by-week record of my GSoC progress on Drop support in gccrs.
This is the rolling agenda for my GSoC sync-ups on Drop support in gccrs.
19 August 2026
Since the last update
- Pushed two patches:
This week
- Address review comments and focus on getting the existing PRs merged.
12 August 2026
Since the last update
- Pushed a patch for conditional BIR Drop-style analysis.
- Temporarily closed the PR because I wanted to revise the design.
This week
- Apply the conditional BIR Drop-style analysis to backend cleanup.
- Add more test cases for behavior that is already supported but not yet covered.
- Address review comments and focus on getting the existing PRs merged.
5 August 2026
Last week
- Pushed two patches:
This week
- Investigate conditional cases and implement conditional BIR drop-style analysis.
- Apply the analysis to the backend and add test cases. This will support conditional moves such as:
fn f(cond: bool) {
let x = Droppable("x");
if cond {
let y = x;
}
}
29 July 2026
Last week
- Pushed a patch separating argument and function-body Drop scopes, making gccrs more closely aligned with rustc: issue #4712, PR #4718.
- Opened issue #4717 about a double Drop when implementing unlabeled
breaksupport. - Investigated BIR in gccrs and how MIR implements control-flow graphs in rustc.
This week
- Implement straight-line BIR Drop-style analysis.
- Use the BIR Drop analysis results to control backend Drop cleanup, supporting cases such as:
let x = Droppable { i: 1 };
let y = x;
22 July 2026
Last week
- Took a few days off.
- Resolved conflicts and applied try/finally cleanup to function scope and explicit returns: PR #4711 (merged) and PR #4621 (under review).
- Added Drop support for unlabeled
breakandcontinue: PR #4710.
This week
- Open an issue and begin refactoring gccrs to align more closely with rustc, following this review discussion.
- Decide whether to keep expanding Drop support for labeled
continue,break, moves, and generics, or prioritize aligning the current gccrs Drop structure with rustc.
15 July 2026
Last week
- Updated the try/finally PR to use
EH_ELSE_EXPR. With this change, the tested program no longer referenced__gccrs_personality_v0: PR #4685. - Applied try/finally cleanup to function scope and explicit returns locally, pending the merge of PR #4685.
This week
- Add support for unlabeled
breakandcontinue. - Open an issue and begin refactoring gccrs to align more closely with rustc, following this review discussion.
- Address review feedback, resolve conflicts, and work towards merging the open PRs.
8 July 2026
Last week
- Responded to feedback on the existing PRs:
- Studied how the Go frontend handles
deferusing try/finally-style cleanup and used it as a reference for Rust Drop cleanup. - Implemented block-scope Drop cleanup using
TRY_FINALLY_EXPRand opened draft PR #4685.
This week
- Discuss how to handle the
__gccrs_personality_v0issue and follow up based on maintainer feedback. - Continue function-scope and explicit-return cleanup if the
TRY_FINALLY_EXPRdirection is confirmed. - Work on Drop support for unlabeled
breakandcontinue:
loop {
let x = Droppable;
if cond() {
break; // drop x before leaving the loop
}
if other_cond() {
continue; // drop x before the next iteration
}
work();
}
1 July 2026
Last week
- Pushed PRs to:
- Support explicit returns
- Add more test cases for the non-unit tail function case
- Test LIFO Drop order and nested scopes
This week
- Address review comments, resolve conflicts, and work towards merging the open PRs.
- Develop a try/finally-based design so Drop calls do not need to be emitted manually at every exit point. For example:
fn f() {
let a = Droppable;
{
let x = Droppable;
}
work();
}
This could be lowered into a structure like:
try {
let a = Droppable;
try {
let x = Droppable;
} finally {
drop(x);
}
work();
} finally {
drop(a);
}
24 June 2026
Last week
- Pushed PR #4586 to refactor the Drop infrastructure.
- Started work on function-scope cases, including unit tail expressions and function parameter drops: PR #4591.
This week
- Update the Drop infrastructure refactor and function-scope support PRs based on feedback.
- Start implementing Drop support for explicit return expressions:
// 1. Unit explicit return
fn f() {
let _x = Droppable;
return;
}
// 2. Unit explicit return expression
fn f() {
let _x = Droppable;
return make_unit();
}
// 3. Non-unit explicit return expression
fn f() -> i32 {
let _x = Droppable;
return make_value();
}
// 4. Nested explicit returns
fn f() {
let _outer = Droppable;
{
let _inner = Droppable;
return;
}
}
17 June 2026
Last week
- Studied rustc 1.49 and made a table of Drop insertion points.
- Pushed two commits:
- Supported the basic function-call case:
fn main() -> i32 { let _x = Droppable; 0 }. - Addressed feedback by adding missing copyright headers, fixing an include guard name, and asserting that Drop lookup returns a single function candidate.
- Supported the basic function-call case:
This week
- Refactor
CompileDropto store and reuseContextas a class member instead of passingContext *ctxto each method. - Explore new
DropBuilderAPIs such aspeek_block_drop_candidatesandnote_simple_drop_candidate. - Complete function-scope Drop support, including unit tail expressions and, possibly the following week, function parameters:
// Unit tail expression
fn foo() {}
fn f() {
let _x = Droppable;
foo()
}
// Function parameter
fn foo(x: Droppable) {}
10 June 2026
Action items
- Study the rustc 1.49 source to locate the Drop infrastructure, establish a reference point, and understand the expected behavior in more detail.
- Consider suitable APIs for the Drop implementation.
Last week
- Completed all scheduled tasks.
- Moved the Drop helper into separate files: commit cf048a3.
This week
- Work on function-call cases.
- Investigate Drop insertion points in rustc 1.49.
3 June 2026
Last week
- Pushed a draft PR for the simple block-exit Drop implementation and added comments to explain the code.
This week
- Add more test cases for the current scope.
- Update the draft PR based on feedback.
- Investigate the backend Drop insertion point. Block cases are supported, but function-call cases such as the following are not yet supported:
fn main() -> i32 {
let _x = Droppable;
0
}
API discussion
Arthur suggested that future Drop APIs could look something like this:
auto dropper = DropBuilder();
/* ... */
dropper.note_simple_candidate(...);
/* ... */
dropper.peek_block_candidates();
/* ... */
for (auto stmt : dropper.compile_drop_calls())
ctx->add_statement(stmt);
27 May 2026
- First introduction meeting. 🎉
- Opened PR #4559 to add Drop as a lang item; it was reviewed, approved, and merged.
- Planned a first WIP/draft PR implementing basic drops for the following week.