Skip to content

Phase 4.1 — Conformance: moved value is invalidated after function call #35

Description

@whoisclebs

Parent

Part of #6 (Phase 4: Implement ownership and move semantics).

Background

Passing a non-Copy value to a function transfers ownership. After the call the original binding is consumed — any subsequent read is a compile error (use-after-move). This is the most basic move-semantics test: one value, one move, one function call.

Spec reference: docs/design/spec.md §3 · Lint: use-after-move · Crate: paco-borrow

What already exists

  • compiler/paco-borrow/src/lib.rs — definite-assignment / move-state dataflow; emits use-after-move.
  • compiler/paco-test-harness/src/lib.rs — golden test harness.

Scope

  • Create tests/conformance/phase_04/move_into_fn/input.paco — a consume(s: string) function plus main that moves a string into it and then attempts a second use.
  • Create tests/conformance/phase_04/move_into_fn/expected.stderr with the use-after-move diagnostic and span pointing at the second use.
  • Create tests/conformance/phase_04/move_into_fn/flags.toml with kind = "fail" and feature_min = 4.

Acceptance Criteria

  • Compilation fails with a use-after-move diagnostic.
  • Span points at the second use of the moved variable.
  • expected.stderr matches actual stderr byte-for-byte.
  • All previously passing conformance tests remain green.

Key files

  • tests/conformance/phase_04/move_into_fn/ — new test directory
  • compiler/paco-borrow/src/lib.rs — move detection
  • 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