Rollup merge of #81730 - RustyYato:object-safe-allocator, r=Amanieu

Make `Allocator` object-safe

This allows rust-lang/wg-allocators#83: polymorphic allocators
This commit is contained in:
Mara Bos 2021-02-05 12:26:05 +01:00 committed by GitHub
commit ff3c85fd65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View file

@ -342,7 +342,10 @@ pub unsafe trait Allocator {
///
/// The returned adaptor also implements `Allocator` and will simply borrow this.
#[inline(always)]
fn by_ref(&self) -> &Self {
fn by_ref(&self) -> &Self
where
Self: Sized,
{
self
}
}