Skip to content

Instantly share code, notes, and snippets.

@pyfisch
Created December 22, 2014 11:00
Show Gist options
  • Save pyfisch/b05359397660949199e1 to your computer and use it in GitHub Desktop.
Save pyfisch/b05359397660949199e1 to your computer and use it in GitHub Desktop.
Rust crash
fn main() {
let testvector = vec![1, 2, 3];
let a: int = testvector[-1];
println!("{}", a);
}
/* The output:
task '<main>' panicked at 'index out of bounds: the len is 3 but the index is 18446744073709551615', /xxxx/src/main.rs:1
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment