Parent
Part of #6 (Phase 4: Implement ownership and move semantics).
Background
RAII (Resource Acquisition Is Initialization) means values are destroyed in reverse declaration order when their scope ends. The compiler inserts Drop calls in this order in the MIR/eval layer. This test verifies the drop order by using a struct whose drop method prints its name — the output order proves the order of destruction.
Spec reference: docs/design/spec.md §3 · Crates: paco-mir, paco-eval
What already exists
compiler/paco-eval/src/lib.rs — executes Drop calls in reverse declaration order at scope exit.
compiler/paco-test-harness/src/lib.rs — golden test harness.
Scope
- Create
tests/conformance/phase_04/drop_order/input.paco — a main that declares two or three named values with drop methods that print; verify the printed sequence is reverse of declaration order.
- Create
tests/conformance/phase_04/drop_order/expected.stdout showing drops in reverse order.
- Create
tests/conformance/phase_04/drop_order/flags.toml with kind = "run" and feature_min = 4.
Acceptance Criteria
Key files
tests/conformance/phase_04/drop_order/ — new test directory
compiler/paco-eval/src/lib.rs — drop-order execution
compiler/paco-driver/tests/conformance.rs — conformance runner
Parent
Part of #6 (Phase 4: Implement ownership and move semantics).
Background
RAII (Resource Acquisition Is Initialization) means values are destroyed in reverse declaration order when their scope ends. The compiler inserts
Dropcalls in this order in the MIR/eval layer. This test verifies the drop order by using a struct whosedropmethod prints its name — the output order proves the order of destruction.Spec reference:
docs/design/spec.md §3· Crates:paco-mir,paco-evalWhat already exists
compiler/paco-eval/src/lib.rs— executesDropcalls in reverse declaration order at scope exit.compiler/paco-test-harness/src/lib.rs— golden test harness.Scope
tests/conformance/phase_04/drop_order/input.paco— amainthat declares two or three named values withdropmethods that print; verify the printed sequence is reverse of declaration order.tests/conformance/phase_04/drop_order/expected.stdoutshowing drops in reverse order.tests/conformance/phase_04/drop_order/flags.tomlwithkind = "run"andfeature_min = 4.Acceptance Criteria
expected.stdoutbyte-for-byte.Key files
tests/conformance/phase_04/drop_order/— new test directorycompiler/paco-eval/src/lib.rs— drop-order executioncompiler/paco-driver/tests/conformance.rs— conformance runner