Open Rua opened 1 month ago
Unfortunately we can't make this change because it would break type inference for a huge portion of the ecosystem. This is the same reason why HashMap::new
only works with the default hasher, even if you are using a custom hasher that implements Default
.
Highly relevant: Gankra's article Defaults Affect Inference in Rust: Expressions Instead Of Types
In my case, the allocator is just an empty struct that calls global functions, but it's not the global allocator. Having to pass
Default::default()
to every constructor is awkward. Is it possible to make the standard constructors likenew
,new_uninit
etc available to non-standard allocators if the allocator implementsDefault
? Then I can just do this: