Parent
Part of #7 (Phase 5: Implement borrowing and lifetime inference).
Background
When a function takes a single reference parameter and returns a reference, the return can only borrow from that one input — the lifetime is unambiguous and the compiler infers it automatically without any annotation. This is the common case and should require zero explicit 'a syntax from the programmer.
Spec reference: docs/design/spec.md §3, ADR 0001, architecture.md §12.3 · Crate: paco-borrow
What already exists
compiler/paco-borrow/src/lib.rs — single-input lifetime inference; infers return lifetime from the sole reference parameter.
compiler/paco-test-harness/src/lib.rs — golden test harness.
Scope
- Create
tests/conformance/phase_05/lifetime_inferred/input.paco — a first_word(s: &string) -> &string function that returns a slice of its input, and a main that calls it and prints the result. No 'a annotations.
- Create
tests/conformance/phase_05/lifetime_inferred/expected.stdout with the expected word.
- Create
tests/conformance/phase_05/lifetime_inferred/flags.toml with kind = "run" and feature_min = 5.
Acceptance Criteria
Key files
tests/conformance/phase_05/lifetime_inferred/ — new test directory
compiler/paco-borrow/src/lib.rs — single-input inference
compiler/paco-driver/tests/conformance.rs — conformance runner
Parent
Part of #7 (Phase 5: Implement borrowing and lifetime inference).
Background
When a function takes a single reference parameter and returns a reference, the return can only borrow from that one input — the lifetime is unambiguous and the compiler infers it automatically without any annotation. This is the common case and should require zero explicit
'asyntax from the programmer.Spec reference:
docs/design/spec.md §3, ADR 0001,architecture.md §12.3· Crate:paco-borrowWhat already exists
compiler/paco-borrow/src/lib.rs— single-input lifetime inference; infers return lifetime from the sole reference parameter.compiler/paco-test-harness/src/lib.rs— golden test harness.Scope
tests/conformance/phase_05/lifetime_inferred/input.paco— afirst_word(s: &string) -> &stringfunction that returns a slice of its input, and amainthat calls it and prints the result. No'aannotations.tests/conformance/phase_05/lifetime_inferred/expected.stdoutwith the expected word.tests/conformance/phase_05/lifetime_inferred/flags.tomlwithkind = "run"andfeature_min = 5.Acceptance Criteria
expected.stdoutbyte-for-byte.Key files
tests/conformance/phase_05/lifetime_inferred/— new test directorycompiler/paco-borrow/src/lib.rs— single-input inferencecompiler/paco-driver/tests/conformance.rs— conformance runner