diff --git a/diesel/src/pg/types/ranges.rs b/diesel/src/pg/types/ranges.rs index 8d2dca05c70b..77fd2548d853 100644 --- a/diesel/src/pg/types/ranges.rs +++ b/diesel/src/pg/types/ranges.rs @@ -73,7 +73,7 @@ where if !flags.contains(RangeFlags::LB_INF) { let elem_size = bytes.read_i32::()?; - let (elem_bytes, new_bytes) = bytes.split_at(elem_size as usize); + let (elem_bytes, new_bytes) = bytes.split_at(elem_size.try_into()?); bytes = new_bytes; let value = T::from_sql(PgValue::new_internal(elem_bytes, &value))?;