typeover
rust curriculum

Curriculum Foundations Compiler feedback exercise 1 · mcq-explain

Compiler feedback

Rust's compiler emits diagnostics that look like the one below. Identify the PRIMARY error line — the one that names the error code and the short summary. The other lines are spans, notes, and help suggestions. error[E0277]: cannot multiply i32 by &str --> src/main.rs:4:9 | 4 | let _ = 7 * "hi"; | ^^^^^^^^^^^^ = note: the trait Mul<&str> is not implemented for i32 help: consider converting the value with .parse::<i32>()

TypeScript reference
Pick the correct explanation

About this theme

Rust is learned with the compiler, not around it. Before ownership starts, learners need the habit of reading error[E...], spans, notes, and help: suggestions. Planned exercises: 1. identify the primary error line. 2. recognise a help: suggestion. 3. choose the fix for a type mismatch. 4. fill a corrected variable name. 5. fill a corrected type. 6. apply a compiler hint to one line. 7. explain why a warning is not an error. 8. fix a short program from a rustc diagnostic. 9. use the diagnostic to repair a function.