mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-13 09:49:11 +03:00
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:
parent
37fbc5ec24
commit
0f4c848978
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user