I think this is an implementation detail. If the allocation is small and does not escape, I'd expect compilers to allocate them on the stack eventually. Future implementations of
String and perhaps even
Vec might use the small string optimization, too, so that the contents effectively lands on the stack.