What’s the logic behind not being able to index with numeric types other than usize

114 points IhaveLost2Accounts

For example

fn main() {
let x: u16 = 0;
let mut v: Vec<u16> = Vec::new();
v.push(1);
let y = v[x];
println!("{y}");
}

Doesn’t run but

fn main() {
let x: u16 = 0;
let mut v: Vec<u16> = Vec::new();
v.push(1);
let y = v[x as usize];
println!("{y}");
}

Does