I don't think that's the case here, it seems this doesn't need any language/library features? The ongoing custom allocator work is orthogonal -- it makes the global infailable allocator model more flexible, but it doesn't fundamentally change it.
In more concrete terms, it seems that we have all the building blocks here since a long time? I am imagining an API like this could work:
pub struct RegexAlloc {
pub alloc: unsafe fn(usize) -> Resul<*mut u8>,
pub free: unsafe fn(*mut u8),
}
pub struct Regex {
...
}
impl Regex {
fn new(a: RegexAlloc, re: &str) -> Result<Regex>
}
Obviously, there are a lot of details library designers would have to nail down here, but, fundamentally, there's no requrenment that the API is provided by std.