diff options
| author | Simon Sapin <simon.sapin@exyr.org> | 2018-04-04 18:57:48 +0200 |
|---|---|---|
| committer | Simon Sapin <simon.sapin@exyr.org> | 2018-04-12 22:53:21 +0200 |
| commit | eae0d468932660ca383e35bb9d8b0cb4943a82ae (patch) | |
| tree | 818c14771c58c3fe97bd5d6c18bb94e30fe2064e /src/librustc_allocator | |
| parent | 96c9d225a9667bc5ffcbc1594d44c29b201e999c (diff) | |
| download | rust-eae0d468932660ca383e35bb9d8b0cb4943a82ae.tar.gz rust-eae0d468932660ca383e35bb9d8b0cb4943a82ae.zip | |
Restore Global.oom() functionality
… now that #[global_allocator] does not define a symbol for it
Diffstat (limited to 'src/librustc_allocator')
| -rw-r--r-- | src/librustc_allocator/expand.rs | 5 | ||||
| -rw-r--r-- | src/librustc_allocator/lib.rs | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/librustc_allocator/expand.rs b/src/librustc_allocator/expand.rs index ce41fe1f3bc..58d4c7f289c 100644 --- a/src/librustc_allocator/expand.rs +++ b/src/librustc_allocator/expand.rs @@ -231,6 +231,7 @@ impl<'a> AllocFnFactory<'a> { } AllocatorTy::ResultPtr | + AllocatorTy::Bang | AllocatorTy::Unit => { panic!("can't convert AllocatorTy to an argument") } @@ -248,6 +249,10 @@ impl<'a> AllocFnFactory<'a> { (self.ptr_u8(), expr) } + AllocatorTy::Bang => { + (self.cx.ty(self.span, TyKind::Never), expr) + } + AllocatorTy::Unit => { (self.cx.ty(self.span, TyKind::Tup(Vec::new())), expr) } diff --git a/src/librustc_allocator/lib.rs b/src/librustc_allocator/lib.rs index 969086815de..706eab72d44 100644 --- a/src/librustc_allocator/lib.rs +++ b/src/librustc_allocator/lib.rs @@ -24,6 +24,11 @@ pub static ALLOCATOR_METHODS: &[AllocatorMethod] = &[ output: AllocatorTy::ResultPtr, }, AllocatorMethod { + name: "oom", + inputs: &[], + output: AllocatorTy::Bang, + }, + AllocatorMethod { name: "dealloc", inputs: &[AllocatorTy::Ptr, AllocatorTy::Layout], output: AllocatorTy::Unit, @@ -47,6 +52,7 @@ pub struct AllocatorMethod { } pub enum AllocatorTy { + Bang, Layout, Ptr, ResultPtr, |
