diff options
| author | bors <bors@rust-lang.org> | 2020-01-28 08:44:20 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-01-28 08:44:20 +0000 |
| commit | b181835a6bacfa449f55d46764a10e25d1c471dc (patch) | |
| tree | 7a5af02ac37fe47a4a0761fa5662caa062cb6a60 /src/test | |
| parent | 82018665a5f2c34566b30c1b0b5a27c72d3b9a68 (diff) | |
| parent | 7ca25db8162128808714f536fa993aefcf6a2239 (diff) | |
| download | rust-b181835a6bacfa449f55d46764a10e25d1c471dc.tar.gz rust-b181835a6bacfa449f55d46764a10e25d1c471dc.zip | |
Auto merge of #68529 - TimDiekmann:rename-alloc, r=Amanieu
Rename `Alloc` to `AllocRef` The allocator-wg has decided to merge this change upstream in https://github.com/rust-lang/wg-allocators/issues/8#issuecomment-577122958. This renames `Alloc` to `AllocRef` because types that implement `Alloc` are a reference, smart pointer, or ZSTs. It is not possible to have an allocator like `MyAlloc([u8; N])`, that owns the memory and also implements `Alloc`, since that would mean, that moving a `Vec<T, MyAlloc>` would need to correct the internal pointer, which is not possible as we don't have move constructors. For further explanation please see https://github.com/rust-lang/wg-allocators/issues/8#issuecomment-489464843 and the comments after that one. Additionally it clarifies the semantics of `Clone` on an allocator. In the case of `AllocRef`, it is clear that the cloned handle still points to the same allocator instance, and that you can free data allocated from one handle with another handle. The initial proposal was to rename `Alloc` to `AllocHandle`, but `Ref` expresses the semantics better than `Handle`. Also, the only appearance of `Handle` in `std` are for windows specific resources, which might be confusing. Blocked on https://github.com/rust-lang/miri/pull/1160
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/allocator-alloc-one.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/allocator/custom.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/allocator/xcrate-use.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/realloc-16687.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/regions/regions-mock-codegen.rs | 2 |
5 files changed, 5 insertions, 5 deletions
diff --git a/src/test/ui/allocator-alloc-one.rs b/src/test/ui/allocator-alloc-one.rs index 312d5f13b1a..b821a2c5939 100644 --- a/src/test/ui/allocator-alloc-one.rs +++ b/src/test/ui/allocator-alloc-one.rs @@ -4,7 +4,7 @@ #![feature(allocator_api, nonnull)] -use std::alloc::{Alloc, Global, Layout, handle_alloc_error}; +use std::alloc::{AllocRef, Global, Layout, handle_alloc_error}; fn main() { unsafe { diff --git a/src/test/ui/allocator/custom.rs b/src/test/ui/allocator/custom.rs index 71f72ae46c2..0b1f6d5a96e 100644 --- a/src/test/ui/allocator/custom.rs +++ b/src/test/ui/allocator/custom.rs @@ -7,7 +7,7 @@ extern crate helper; -use std::alloc::{self, Global, Alloc, System, Layout}; +use std::alloc::{self, Global, AllocRef, System, Layout}; use std::sync::atomic::{AtomicUsize, Ordering}; static HITS: AtomicUsize = AtomicUsize::new(0); diff --git a/src/test/ui/allocator/xcrate-use.rs b/src/test/ui/allocator/xcrate-use.rs index 039c70e77be..37b28c195df 100644 --- a/src/test/ui/allocator/xcrate-use.rs +++ b/src/test/ui/allocator/xcrate-use.rs @@ -9,7 +9,7 @@ extern crate custom; extern crate helper; -use std::alloc::{Global, Alloc, System, Layout}; +use std::alloc::{Global, AllocRef, System, Layout}; use std::sync::atomic::{Ordering, AtomicUsize}; #[global_allocator] diff --git a/src/test/ui/realloc-16687.rs b/src/test/ui/realloc-16687.rs index 69292d241c3..425aa83e70a 100644 --- a/src/test/ui/realloc-16687.rs +++ b/src/test/ui/realloc-16687.rs @@ -6,7 +6,7 @@ #![feature(allocator_api)] -use std::alloc::{Global, Alloc, Layout, handle_alloc_error}; +use std::alloc::{Global, AllocRef, Layout, handle_alloc_error}; use std::ptr::{self, NonNull}; fn main() { diff --git a/src/test/ui/regions/regions-mock-codegen.rs b/src/test/ui/regions/regions-mock-codegen.rs index 521ef3f6a4b..f50b1c8b17f 100644 --- a/src/test/ui/regions/regions-mock-codegen.rs +++ b/src/test/ui/regions/regions-mock-codegen.rs @@ -6,7 +6,7 @@ #![feature(allocator_api)] -use std::alloc::{Alloc, Global, Layout, handle_alloc_error}; +use std::alloc::{AllocRef, Global, Layout, handle_alloc_error}; use std::ptr::NonNull; struct arena(()); |
