← Contribution overview

Additional Drop test coverage ยท PR #4789

Add execute tests for supported Drop behavior

Merged

Objective

Add execute-test coverage for supported Drop behavior: multiple function parameters, explicit returns, ownership moves through function arguments and return values, and values local to if and else branches.

Why it was needed

These compiler behaviors already worked, but their runtime results were missing or only partly covered by execute tests.

This test-only PR records the expected behavior; it does not add new Drop support.

Main changes

  • Extends the explicit-return test to cover one local and two function parameters.
  • Adds a test for ownership moves through function arguments, parameters, and return values.
  • Extends the function-parameter test to cover two parameters and their Drop order.
  • Adds a test for local values in both if and else branches.

Test cases

  • drop-explicit-return.rs: Checks that an explicit return drops the body local, then the second parameter, then the first parameter.
  • drop-function-boundary-moves.rs: Checks moves through a function argument, from a parameter to a local, and through a return value.
  • drop-function-params.rs: Checks that a body local drops before two parameters, and that the parameters drop in reverse order.
  • drop-if-else-local.rs: Runs both branches and checks that each branch-local value drops before control continues after the if.
View PR on GitHub ← Contribution overview