Parent
Part of #7 (Phase 5: Implement borrowing and lifetime inference).
Background
When a function takes two or more reference parameters and returns a reference, inference cannot determine which input the return borrows from without additional information. The compiler must reject the ambiguous form and include the exact 'a annotation to paste in the diagnostic — the developer confirms, not guesses. This is the key ergonomics guarantee of Paco's lifetime model.
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 — ambiguity detection; emits the suggested annotation in the diagnostic text.
compiler/paco-test-harness/src/lib.rs — golden test harness.
Scope
- Create
tests/conformance/phase_05/lifetime_ambiguous/input.paco — a pick(x: &string, y: &string) -> &string function with two reference inputs. No annotation.
- Create
tests/conformance/phase_05/lifetime_ambiguous/expected.stderr — the lifetime error including a help: line with the suggested 'a annotation.
- Create
tests/conformance/phase_05/lifetime_ambiguous/flags.toml with kind = "fail" and feature_min = 5.
- Also create
tests/conformance/phase_05/lifetime_explicit/ — the corrected version with explicit 'a annotations that compiles and runs.
Acceptance Criteria
Key files
tests/conformance/phase_05/lifetime_ambiguous/ — must-fail test
tests/conformance/phase_05/lifetime_explicit/ — fixed version
compiler/paco-borrow/src/lib.rs — ambiguity detection and suggestion
compiler/paco-driver/tests/conformance.rs — conformance runner
Parent
Part of #7 (Phase 5: Implement borrowing and lifetime inference).
Background
When a function takes two or more reference parameters and returns a reference, inference cannot determine which input the return borrows from without additional information. The compiler must reject the ambiguous form and include the exact
'aannotation to paste in the diagnostic — the developer confirms, not guesses. This is the key ergonomics guarantee of Paco's lifetime model.Spec reference:
docs/design/spec.md §3, ADR 0001,architecture.md §12.3· Crate:paco-borrowWhat already exists
compiler/paco-borrow/src/lib.rs— ambiguity detection; emits the suggested annotation in the diagnostic text.compiler/paco-test-harness/src/lib.rs— golden test harness.Scope
tests/conformance/phase_05/lifetime_ambiguous/input.paco— apick(x: &string, y: &string) -> &stringfunction with two reference inputs. No annotation.tests/conformance/phase_05/lifetime_ambiguous/expected.stderr— the lifetime error including ahelp:line with the suggested'aannotation.tests/conformance/phase_05/lifetime_ambiguous/flags.tomlwithkind = "fail"andfeature_min = 5.tests/conformance/phase_05/lifetime_explicit/— the corrected version with explicit'aannotations that compiles and runs.Acceptance Criteria
Key files
tests/conformance/phase_05/lifetime_ambiguous/— must-fail testtests/conformance/phase_05/lifetime_explicit/— fixed versioncompiler/paco-borrow/src/lib.rs— ambiguity detection and suggestioncompiler/paco-driver/tests/conformance.rs— conformance runner