https://doc.rust-lang.org/nomicon/exception-safety.html
struct Hole<'a, T: 'a> {
data: &'a mut [T],
/// `elt` is always `Some` from new until drop.
elt: Option<T>,
pos: usize,
}
impl<'a, T> Hole<'a, T> {
// ...
unsafe fn get(&self, index: usize) -> &T { &self.data[index] }
// ...
}
Why is get here marked as unsafe? It doesn't seem to be performing anything particularly unsafe, any more so than regular safe code might do. Rust compiler also doesn't require it to be unsafe.