diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2021-02-05 12:26:05 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-05 12:26:05 +0100 |
| commit | ff3c85fd65fa875d2fa4bfdd790cf8dcfaba6ba3 (patch) | |
| tree | cbb5476e3ab1951245e5e103265c64621a4158d9 /library/core/src/alloc/mod.rs | |
| parent | 21c276f9c87daa5fc5ff34e81fd1f1d5112afe00 (diff) | |
| parent | d06384ac29098c3a4b3e21eb2f70093e800bd1b6 (diff) | |
| download | rust-ff3c85fd65fa875d2fa4bfdd790cf8dcfaba6ba3.tar.gz rust-ff3c85fd65fa875d2fa4bfdd790cf8dcfaba6ba3.zip | |
Rollup merge of #81730 - RustyYato:object-safe-allocator, r=Amanieu
Make `Allocator` object-safe This allows rust-lang/wg-allocators#83: polymorphic allocators
Diffstat (limited to 'library/core/src/alloc/mod.rs')
| -rw-r--r-- | library/core/src/alloc/mod.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/library/core/src/alloc/mod.rs b/library/core/src/alloc/mod.rs index 045eb58d013..9c2a0146e2c 100644 --- a/library/core/src/alloc/mod.rs +++ b/library/core/src/alloc/mod.rs @@ -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 } } |
