Error Handling in Rust
Unrecoverable errors
These errors are a sign that the developer made a mistake. An example of this, could be trying to access an index that is out of bounds. For example:
1
2
3
4
5
6
7
8
fn get_number() -> usize {
return 5;
}
fn main() {
let numbers = [1, 2];
println!("{}", numbers[get_number()]);
}