@llambda You're storing references to the elements in the vector in the kdtree, thus the vector is being borrowed
@llambda While something is borrowed, you cannot mutate it
@llambda Since a vector has a single contiguous buffer, when you're pushing elements it sometimes has to allocate a new larger buffer. When this happens all pointers to elements in that buffer become dangling pointers. Rust prevents this.
@llambda What you can do is first store all the items in the Vec, and then once that is done and you no longer need to modify the Vec, then you can shove references to the elements into your kdtree