Some of the underlying buffers we use will dynamically grow themselves as needed.
In the incredibly rare case they fail to allocate (or have more than isize::MAX elements), this allocation function returns an error.
However, there is no practical way to test this with the built in Global allocator.
Instead, we should create our own mock allocator, which just always fails to allocate. And use this for the tests I'm describing.
Unfortunately, the Allocator API is not available on stable Rust yet. So we have no way to mock it yet.
See rust-lang/rust#32838
Some of the underlying buffers we use will dynamically grow themselves as needed.
In the incredibly rare case they fail to allocate (or have more than
isize::MAXelements), this allocation function returns an error.However, there is no practical way to test this with the built in
Globalallocator.Instead, we should create our own mock allocator, which just always fails to allocate. And use this for the tests I'm describing.
Unfortunately, the Allocator API is not available on stable Rust yet. So we have no way to mock it yet.
See rust-lang/rust#32838