Code Room
Code reviewHard
Question
Review this Rust code that shares a slice with a scoped-looking thread.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
use std::thread; fn process(data: &[u8]) -> u32 { data.iter().map(|&b| b as u32).sum()} fn run() -> u32 { let buf = vec![1u8, 2, 3, 4]; let r = &buf; let handle = thread::spawn(move || process(r)); let total = handle.join().unwrap(); drop(buf); total}Run or narrate your approach, then ask the coach.