fix gear lookup allocated on stack
authoralfadur
Sat, 03 Aug 2019 02:14:07 +0300
changeset 15292 3bb3fe1cf87c
parent 15291 16bd389fc735
child 15293 0f734fa371e1
fix gear lookup allocated on stack
rust/hwphysics/src/common.rs
--- a/rust/hwphysics/src/common.rs	Sat Aug 03 01:13:45 2019 +0300
+++ b/rust/hwphysics/src/common.rs	Sat Aug 03 02:14:07 2019 +0300
@@ -108,13 +108,13 @@
 }
 
 pub struct GearDataLookup<T> {
-    lookup: [LookupEntry<T>; u16::max_value() as usize],
+    lookup: Box<[LookupEntry<T>]>,
 }
 
 impl<T: Default + Copy> GearDataLookup<T> {
     pub fn new() -> Self {
         Self {
-            lookup: [LookupEntry::<T>::default(); u16::max_value() as usize],
+            lookup: Vec::with_capacity(u16::max_value() as usize).into_boxed_slice()
         }
     }
 }