Parent
Part of #6 (Phase 4: Implement ownership and move semantics).
Background
Primitive types — int, float, bool, char, byte — implement Copy: assigning or passing them duplicates the value rather than moving it. A binding of a Copy type remains valid after being "passed" to a function or assigned to another variable. This test confirms that no use-after-move error is emitted for Copy types, even when the same variable is passed to multiple functions.
Spec reference: docs/design/spec.md §3 · Crate: paco-borrow
What already exists
compiler/paco-borrow/src/lib.rs — is_copy_type() check bypasses move tracking for primitive types.
compiler/paco-test-harness/src/lib.rs — golden test harness.
Scope
- Create
tests/conformance/phase_04/copy_type/input.paco — a main that passes the same int to two different functions and then uses it again, all without error.
- Create
tests/conformance/phase_04/copy_type/expected.stdout with the expected output.
- Create
tests/conformance/phase_04/copy_type/flags.toml with kind = "run" and feature_min = 4.
Acceptance Criteria
Key files
tests/conformance/phase_04/copy_type/ — new test directory
compiler/paco-borrow/src/lib.rs — Copy classification
compiler/paco-driver/tests/conformance.rs — conformance runner
Parent
Part of #6 (Phase 4: Implement ownership and move semantics).
Background
Primitive types —
int,float,bool,char,byte— implementCopy: assigning or passing them duplicates the value rather than moving it. A binding of aCopytype remains valid after being "passed" to a function or assigned to another variable. This test confirms that nouse-after-moveerror is emitted forCopytypes, even when the same variable is passed to multiple functions.Spec reference:
docs/design/spec.md §3· Crate:paco-borrowWhat already exists
compiler/paco-borrow/src/lib.rs—is_copy_type()check bypasses move tracking for primitive types.compiler/paco-test-harness/src/lib.rs— golden test harness.Scope
tests/conformance/phase_04/copy_type/input.paco— amainthat passes the sameintto two different functions and then uses it again, all without error.tests/conformance/phase_04/copy_type/expected.stdoutwith the expected output.tests/conformance/phase_04/copy_type/flags.tomlwithkind = "run"andfeature_min = 4.Acceptance Criteria
use-after-movediagnostic.intcan be passed to multiple call sites.expected.stdoutbyte-for-byte.Key files
tests/conformance/phase_04/copy_type/— new test directorycompiler/paco-borrow/src/lib.rs—Copyclassificationcompiler/paco-driver/tests/conformance.rs— conformance runner