logoalt Hacker News

tialaramex • yesterday at 9:51 PM • 0 replies • view on HN

That's six, which is hardly dozens. All of the examples you gave aren't allocator aware. They will reject a Vec<T,Goose> unless Goose is actually the Global allocator. Even if Goose is equivalent by Rust's allocator rules that's not good enough, the type matching wants an exact match not just allocator equivalence.

And this makes some sense because Vec<T,Global> has properties they may care about since they're the new owners of this Vec, they don't want a Vec<T,Goose> which might have very different ideas about allocation.

As your parent says, most APIs care about slices and thus do not communicate an allocator, so they're agnostic to allocation.