I often want to access elements in a slice from the end:
&mut slice[ slice.len() - index ]
However, borrow checker complains:
sliceas immutable because it is also borrowed as mutable
If I use a method (
.get_mut(slice.len() - index).unwrap()), then everything is fine.
Therefore, I think the indexing syntax should work the same.