On 08.08.24 10:55, Benno Lossin wrote: > On 08.08.24 01:05, Danilo Krummrich wrote: >> It's also not that we safe code with that. `Box`, `Vec`, any other user, still >> would have to create the `Layout` before they call `A::free`. > > But for `Box` it would just be `Layout::<T>::new()` and `Vec` needs > `Layout::<T>::new().repeat(self.cap)`. > > Though for `repeat` we need the `alloc_layout_extra` feature, which is > an argument against doing this. Oops, I overlooked the `Layout::array` function, so this is not a problem. Instead it just is `Layout::<T>::array(self.cap).unwrap()`. --- Cheers, Benno