Open and answer this issue on GitHub.
bug, ready · opened 2026-11-29 · updated 2026-11-29 · 0 comments
struct P { x: i64, y: bool }
enum E { A(P), B }
fn g(e: ref E, d: ref E) -> P? {
return match (e, d) { (E::A(p), E::B) => p with { x: 2 }, else => null }
}
fn main() throws {
let p = P { x: 0, y: true }
let r = g(E::A(p), E::B) ?? p
println(f"{r.x} {r.y}")
}
On c2554dfb this gives NK1343.
NK1173 (“with needs the value itself, but this is only a view of a P”), as the same with gives on match e { E::A(p) => p with { x: 2 }, ... }.
Not traced. Possibly the checker’s NK1173 check does not see the view through a pattern on a tuple subject.
.stderr.The probe gives NK1173.
Found during “A chain over io::lines() is one loop the compiler writes, a kept chain a state it writes, and the view steps leave Rust (ADR-chain-loop-v1 D6, D7)” (#2899).