← Back to archive

Stdle #85 · closures · 2026-08-30

What does this Rust snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

fn make() -> impl FnMut() -> i32 {
let mut n = 10;
move || { n += 5; n }
}
fn main() {
let mut a = make();
let mut b = make();
println!("{} {} {}", a(), a(), b());
}
Closures
4 attempts left

Answer & explanation