From dc28d6244c625353daf2686d4d2b79cf5f08caca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Wed, 12 Jul 2017 22:32:43 +0200 Subject: [PATCH] Revert "Auto merge of #17633 - servo:rustup, r=nox" This reverts commit 327e72aa149cdad347196f37bdb64c3afc5ae5e0, reversing changes made to eec51cdd575cf985bc1ed926c6cb8868f1ba0e0e. --- components/gfx/lib.rs | 6 ++++-- components/gfx/platform/freetype/font_context.rs | 15 +++++---------- rust-commit-hash | 2 +- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/components/gfx/lib.rs b/components/gfx/lib.rs index c4418860278..10ba03c0dbc 100644 --- a/components/gfx/lib.rs +++ b/components/gfx/lib.rs @@ -3,9 +3,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ // For SIMD -#![cfg_attr(any(target_os = "linux", target_os = "android"), feature(alloc, allocator_api))] -#![feature(box_syntax)] #![feature(cfg_target_feature)] +#![cfg_attr(any(target_os = "linux", target_os = "android"), feature(heap_api))] + +#![cfg_attr(any(target_os = "linux", target_os = "android"), feature(alloc))] +#![feature(box_syntax)] #![feature(range_contains)] #![feature(unique)] diff --git a/components/gfx/platform/freetype/font_context.rs b/components/gfx/platform/freetype/font_context.rs index bca6de5484e..86643ae348b 100644 --- a/components/gfx/platform/freetype/font_context.rs +++ b/components/gfx/platform/freetype/font_context.rs @@ -2,8 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use alloc::allocator::{Alloc, Layout}; -use alloc::heap::Heap; +use alloc::heap; use freetype::freetype::FT_Add_Default_Modules; use freetype::freetype::FT_Done_Library; use freetype::freetype::FT_Library; @@ -27,8 +26,7 @@ const FT_ALIGNMENT: usize = 1; extern fn ft_alloc(mem: FT_Memory, req_size: c_long) -> *mut c_void { unsafe { - let layout = Layout::from_size_align(req_size as usize, FT_ALIGNMENT).unwrap(); - let ptr = Heap.alloc(layout).unwrap() as *mut c_void; + let ptr = heap::allocate(req_size as usize, FT_ALIGNMENT) as *mut c_void; let actual_size = heap_size_of(ptr as *const _); let user = (*mem).user as *mut User; @@ -45,8 +43,7 @@ extern fn ft_free(mem: FT_Memory, ptr: *mut c_void) { let user = (*mem).user as *mut User; (*user).size -= actual_size; - let layout = Layout::from_size_align(actual_size, FT_ALIGNMENT).unwrap(); - Heap.dealloc(ptr as *mut u8, layout); + heap::deallocate(ptr as *mut u8, actual_size, FT_ALIGNMENT); } } @@ -54,10 +51,8 @@ extern fn ft_realloc(mem: FT_Memory, _cur_size: c_long, new_req_size: c_long, old_ptr: *mut c_void) -> *mut c_void { unsafe { let old_actual_size = heap_size_of(old_ptr as *const _); - let old_layout = Layout::from_size_align(old_actual_size, FT_ALIGNMENT).unwrap(); - let new_layout = Layout::from_size_align(new_req_size as usize, FT_ALIGNMENT).unwrap(); - let result = Heap.realloc(old_ptr as *mut u8, old_layout, new_layout); - let new_ptr = result.unwrap() as *mut c_void; + let new_ptr = heap::reallocate(old_ptr as *mut u8, old_actual_size, + new_req_size as usize, FT_ALIGNMENT) as *mut c_void; let new_actual_size = heap_size_of(new_ptr as *const _); let user = (*mem).user as *mut User; diff --git a/rust-commit-hash b/rust-commit-hash index 3c36fc5cbcf..3a022687970 100644 --- a/rust-commit-hash +++ b/rust-commit-hash @@ -1 +1 @@ -696412de7e4e119f8536686c643621115b90c775 +3bfc18a9619a5151ff4f11618db9cd882996ba6f