The kernel has very small stacks, and Box::try_new(T {}) does not reliably avoid putting T {} on the stack. It seems the only reasonable way to guarantee that T does not make a trip through the stack is to use unsafe code, with Box::try_new_zeroed() or similar. This requires the new_uninit feature.
I'd love to hear any better ideas of how to handle this... try_new_zeroed only really works safely for types where the zero bit pattern is valid, which doesn't cover all cases that Box::try_new(T {}); does.
The kernel has very small stacks, and
Box::try_new(T {})does not reliably avoid puttingT {}on the stack. It seems the only reasonable way to guarantee thatTdoes not make a trip through the stack is to use unsafe code, withBox::try_new_zeroed()or similar. This requires thenew_uninitfeature.I'd love to hear any better ideas of how to handle this...
try_new_zeroedonly really works safely for types where the zero bit pattern is valid, which doesn't cover all cases thatBox::try_new(T {});does.