← Back to archive

Stdle #20 · classes · 2026-06-26

What does this Rust snippet output?

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

#[derive(Debug)]
enum Tree {
Leaf(i32),
Node(Box<Tree>, Box<Tree>),
}
fn main() {
let t = Tree::Node(
Box::new(Tree::Leaf(1)),
Box::new(Tree::Leaf(2)),
);
println!("{:?}", t);
}
Classes
4 attempts left

Answer & explanation