Skip to content

Apache DataFusion SQL Query Engine

ARROW-2441: [Rust] Builder<T>::slice_mut assertions are too strict

Andy Grove59253b648567
diff --git a/rust/src/builder.rs b/rust/src/builder.rs
index 15f492d6db..421b1a9a10 100644
--- a/rust/src/builder.rs
+++ b/rust/src/builder.rs
@@ -65,8 +65,8 @@ impl<T> Builder<T> {
/// Get the internal byte-aligned memory buffer as a mutable slice
pub fn slice_mut(&self, start: usize, end: usize) -> &mut [T] {
assert!(start <= end);
- assert!(start < self.len as usize);
- assert!(end <= self.len as usize);
+ assert!(start < self.capacity as usize);
+ assert!(end <= self.capacity as usize);
unsafe {
slice::from_raw_parts_mut(self.data.offset(start as isize), (end - start) as usize)
}