Growth of Vec is rightfully handled in an uninlined #[cold] function. Unfortunately, this makes Vec's growth opaque to the optimizer, and the optimizer does not "know" what is the new len and capacity of the Vec after reserve.
but actually tries to reserve capacity twice, because the optimizer doesn't know what (try_)reserve does, so it keeps redundant second reserve in extend_from_slice.
but this seems to work only in user code. When I put such hints in the liballoc, they seem to have no effect at all. I've even tried #[inline(always)] in std, but nope.
Any idea how to fix that? I presume that liballoc is special, and perhaps the hints don't survive in it?