Readable errors
- The problem
- A compiler message that talks about lifetimes and borrowing sends you away from your own code.
- An example
- You change a value that you declared without
mut. - What Nikaia checks
- The compiler points at every place the explanation needs:
^under the line with the mistake,-under the line that explains it. Then it says what to write instead. Errors point at your.nikaline and do not talk about lifetimes or borrowing. - The limit
- When no line of yours explains an error, the message says so. Where a check passes a problem on to the Rust compiler underneath, the error it raises is reported against your
.nikaline.
What the compiler says
error[NK1139]: You're changing `count`, but it wasn't declared as mutable.
--> app.nika:4:9
|
2 | let count = 0
| ----- declared here without `mut`
...
4 | count += n
| ^^^^^ changed here
|
= help: Add `mut` where it's declared: `let mut count`.
Go deeper
More under Easy to understand: Code that waits needs no markingFormats are part of the language