Skip to content

Phase 4.4 — Conformance: primitive Copy types are exempt from move restrictions #38

Description

@whoisclebs

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.rsis_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

  • Compiles without any use-after-move diagnostic.
  • The same int can be passed to multiple call sites.
  • Output matches expected.stdout byte-for-byte.
  • All previously passing conformance tests remain green.

Key files

  • tests/conformance/phase_04/copy_type/ — new test directory
  • compiler/paco-borrow/src/lib.rsCopy classification
  • compiler/paco-driver/tests/conformance.rs — conformance runner

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/analysisType system, trait solver, borrow checker, pattern matchingenhancementNew feature or requestphase/4Phase 4: ownership and move semanticsstatus/readyAll dependencies met — ready to implement

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions