Parent
Part of #6 (Phase 4: Implement ownership and move semantics).
Background
When a value is moved inside one branch of an if/else but not the other, the post-if state is ambiguous — the compiler cannot guarantee whether the value is owned or consumed. This inconsistency must be rejected: the binding must be consistently moved in all branches or in none. The dataflow analysis merges states across branches and flags the discrepancy.
Spec reference: docs/design/spec.md §3 · Lint: use-after-move · Crate: paco-borrow
What already exists
compiler/paco-borrow/src/lib.rs — branch-merge logic that requires consistent move state across arms.
compiler/paco-test-harness/src/lib.rs — golden test harness.
Scope
- Create
tests/conformance/phase_04/conditional_move/input.paco — a value moved in the then-branch of an if but used unconditionally after the if.
- Create
tests/conformance/phase_04/conditional_move/expected.stderr with the diagnostic on the post-if use.
- Create
tests/conformance/phase_04/conditional_move/flags.toml with kind = "fail" and feature_min = 4.
Acceptance Criteria
Key files
tests/conformance/phase_04/conditional_move/ — new test directory
compiler/paco-borrow/src/lib.rs — branch-merge move analysis
compiler/paco-driver/tests/conformance.rs — conformance runner
Parent
Part of #6 (Phase 4: Implement ownership and move semantics).
Background
When a value is moved inside one branch of an
if/elsebut not the other, the post-ifstate is ambiguous — the compiler cannot guarantee whether the value is owned or consumed. This inconsistency must be rejected: the binding must be consistently moved in all branches or in none. The dataflow analysis merges states across branches and flags the discrepancy.Spec reference:
docs/design/spec.md §3· Lint:use-after-move· Crate:paco-borrowWhat already exists
compiler/paco-borrow/src/lib.rs— branch-merge logic that requires consistent move state across arms.compiler/paco-test-harness/src/lib.rs— golden test harness.Scope
tests/conformance/phase_04/conditional_move/input.paco— a value moved in thethen-branch of anifbut used unconditionally after theif.tests/conformance/phase_04/conditional_move/expected.stderrwith the diagnostic on the post-ifuse.tests/conformance/phase_04/conditional_move/flags.tomlwithkind = "fail"andfeature_min = 4.Acceptance Criteria
ifuse of the potentially-moved variable.expected.stderrmatches actual stderr byte-for-byte.Key files
tests/conformance/phase_04/conditional_move/— new test directorycompiler/paco-borrow/src/lib.rs— branch-merge move analysiscompiler/paco-driver/tests/conformance.rs— conformance runner