remove RocList.get

It wasn't used outside of `RocDict`'s `IntoIterator`, and in that use case it
was throwing segfaults and bus errors all over the place. I was unable to figure
out what was wrong with it, but since we have an alternative path forward let's
just drop it for now.
This commit is contained in:
Brian Hicks 2022-09-22 06:03:50 -05:00
parent 37fbc5ec24
commit 0f4c848978
No known key found for this signature in database
GPG Key ID: C4F324B9CAAB0D50

View File

@ -103,18 +103,6 @@ impl<T> RocList<T> {
self.len() == 0
}
pub fn get(&self, index: usize) -> Option<&T> {
if self.len() <= index {
return None;
}
let elements = self.elements?;
let element_ptr = unsafe { elements.as_ptr().add(index) };
// Return the element.
Some(unsafe { ManuallyDrop::into_inner(element_ptr.cast::<ManuallyDrop<&T>>().read()) })
}
/// Note that there is no way to convert directly to a Vec.
///
/// This is because RocList values are not allocated using the system allocator, so