match asks for .clone() where EitherText would doOpen and answer this issue on GitHub.
compiler, decision · opened 2026-10-12 · updated 2026-10-12 · 1 comment
Text has three representations below, chosen per position by what flows in (ADR-282 D12-D15):
ref String);EitherText).The walk that chooses them, tools/text_tiers.nika (text_tiers::refine, called from the parser), runs before the checker. It has no types: it reads them off the syntax (tier_struct_of, source_of, place_of).
fn f(v: ref Val) -> String {
return match v {
Val::Int(n) => int_text(n), // owned
Val::Text(t) => t, // a view: v is lent, so t is a view of its part (Part I 3.4)
else => "none".clone(),
}
}
By ADR-282 the result is mixed, so it should be EitherText. The walk does not bind pattern names. An unknown name counts as owned, so it decides String.
#562’s analysis, by the session that took #562 (12 Oct). Order decided by the owner the same day:
NK1104 at t, naming t.clone(), instead of a rustc error. ADR-282 D13 (“leaves the old refusal and never a wrong program”).match.EitherText without a copy.Nothing is blocked. A program writes t.clone() and pays a copy it would not need.
ref String parameter is decided correctly (EitherText). With two returns it runs; as a match it hits #562’s lowering defect.match self.val, match v in a for over self.all, match first(h). Not only a ref parameter.t is owned and today’s answer is right. So the kind of t is the kind of the scrutinee’s place.views.nika (type_of, fields_reached) and text_tiers.nika.place_of)..clone() help, never a wrong program.pub function refuses them (NK1104, ADR-282 D22), where they run today.views.nika could read the same source.docs/selfhosting-plan.md).NK1104 and the pub refusals of D22-D25..clone()s option 1 would remove from std’s Nikaia half and the examples. Count the .clone()s on pattern bindings of a lent scrutinee.return match, a tail match, let r = match … return r, if chains, a mixed field, and an argument to a mixed parameter. The ref String and String arms of an unannotated let meet at String where the function’s result is mixed or not text.f. Checked on 54f34f2: it is NK1104 at the return match, with “Write .clone() to copy it here”. That is a refusal, not a rustc error.return/let, not at the arm: expressions carry no span of their own yet (#558 / ADR-340).Generated by Claude Code