mut on one name of a tuple pattern, and a map’s values written in place (NK1307)Open and answer this issue on GitHub.
note · opened 2026-11-01 · updated 2026-11-01 · 0 comments
Moved here from docs/selfhosting-gaps.md, which is being deleted. Tracks two follow-ups that ADR-views-2 §6 leaves open. The owner deferred them on 2026-10-29 to keep the pace; they are not refused on purpose.
fn main() {
let (a, mut b) = (1, 2)
b += a
println(f"{b}")
}
Result: NK1307, mut in front of one name of a tuple pattern isn’t supported yet.
use std::collections
fn main() {
let mut m: collections::BTreeMap[String, i64] = collections::BTreeMap()
m.insert("a", 1)
for mut v in m.values_mut() { v += 1 }
println(f"{m["a"] ?? 0}")
}
Result: NK1171, collections::BTreeMap has no method called values_mut.
mut is allowed on one name of a tuple pattern, it means the same as let mut on that name alone (D1). The grammar already keeps the place for it.for (k, mut v) in m, lowered as m.iter_mut(), and for (_, mut v) in m, lowered as m.values_mut(). Both need the first point.m[k], outside a loop over m.The status changes to ready once a move needs it, or when the owner takes up the follow-up.