Add support for passing a custom allocator with the new [allocator API](https://github.com/rust-lang/rust/issues/32838).
Add support for passing a custom allocator with the new allocator API.