Rust Quiz
summary
Four short Rust programs compile and print the numbers 1, 1 2 4 3, 1 2 3, and 1. Each example delivers a specific gotcha: method‑call vs field disambiguation makes the first print 1, drop semantics and binding by value vs reference reorder drops in the second, a closure parsed as two statements causes the surprising third result, and a match arm capturing any value earlier makes the final arm dead code so the last prints 1.
AI-written summary · about








