Parent
Part of #7 (Phase 5: Implement borrowing and lifetime inference).
Background
A &mut borrow grants exclusive write access to a value. While a &mut borrow is live no other borrow — shared or mutable — may exist for the same place. This test verifies the positive case: a single &mut T reference correctly enables field mutation, and the aliasing rule is only violated when a second borrow is introduced, which is covered separately.
Spec reference: docs/design/spec.md §3, ADR 0001 · Crate: paco-borrow
What already exists
compiler/paco-borrow/src/lib.rs — &mut loan analysis; mutation through the reference is permitted.
compiler/paco-test-harness/src/lib.rs — golden test harness.
Scope
- Create
tests/conformance/phase_05/mutable_borrow/input.paco — a fn increment(n: &mut int) that adds 1 to *n, and a main that calls it and prints the updated value.
- Create
tests/conformance/phase_05/mutable_borrow/expected.stdout with the incremented value.
- Create
tests/conformance/phase_05/mutable_borrow/flags.toml with kind = "run" and feature_min = 5.
Acceptance Criteria
Key files
tests/conformance/phase_05/mutable_borrow/ — new test directory
compiler/paco-borrow/src/lib.rs — mutable-loan tracking
compiler/paco-driver/tests/conformance.rs — conformance runner
Parent
Part of #7 (Phase 5: Implement borrowing and lifetime inference).
Background
A
&mutborrow grants exclusive write access to a value. While a&mutborrow is live no other borrow — shared or mutable — may exist for the same place. This test verifies the positive case: a single&mut Treference correctly enables field mutation, and the aliasing rule is only violated when a second borrow is introduced, which is covered separately.Spec reference:
docs/design/spec.md §3, ADR 0001 · Crate:paco-borrowWhat already exists
compiler/paco-borrow/src/lib.rs—&mutloan analysis; mutation through the reference is permitted.compiler/paco-test-harness/src/lib.rs— golden test harness.Scope
tests/conformance/phase_05/mutable_borrow/input.paco— afn increment(n: &mut int)that adds 1 to*n, and amainthat calls it and prints the updated value.tests/conformance/phase_05/mutable_borrow/expected.stdoutwith the incremented value.tests/conformance/phase_05/mutable_borrow/flags.tomlwithkind = "run"andfeature_min = 5.Acceptance Criteria
&mutis reflected in the original binding.expected.stdoutbyte-for-byte.Key files
tests/conformance/phase_05/mutable_borrow/— new test directorycompiler/paco-borrow/src/lib.rs— mutable-loan trackingcompiler/paco-driver/tests/conformance.rs— conformance runner