servo: Merge #17714 - Update to rustc 1.20.0-nightly (f85579d4a 2017-07-12) (from servo:rustup); r=SimonSapin
authorSimon Sapin <simon.sapin@exyr.org>
Thu, 13 Jul 2017 12:56:56 -0700
changeset 419945 4aa5d6d08c92f0d9221fcddbd7e0c59dd7c2de62
parent 419944 661bc507a7d6147e0890f3b1b109e680478d025d
child 419946 ea77b5335c13f375571e69c92f1d805ea707fbc8
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersSimonSapin
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
servo: Merge #17714 - Update to rustc 1.20.0-nightly (f85579d4a 2017-07-12) (from servo:rustup); r=SimonSapin Source-Repo: https://github.com/servo/servo Source-Revision: 51c94954d1116eb7f60b067a73a830ebb305726f
servo/components/gfx/lib.rs
servo/components/gfx/platform/freetype/font_context.rs
servo/rust-commit-hash
--- a/servo/components/gfx/lib.rs
+++ b/servo/components/gfx/lib.rs
@@ -1,26 +1,21 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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/. */
 
 // For SIMD
+#![cfg_attr(any(target_os = "linux", target_os = "android"), feature(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)]
 
 #![deny(unsafe_code)]
 
-#[cfg(any(target_os = "linux", target_os = "android"))]
-extern crate alloc;
-
 extern crate app_units;
 #[macro_use]
 extern crate bitflags;
 
 // Mac OS-specific library dependencies
 #[cfg(target_os = "macos")] extern crate byteorder;
 #[cfg(target_os = "macos")] extern crate core_foundation;
 #[cfg(target_os = "macos")] extern crate core_graphics;
--- a/servo/components/gfx/platform/freetype/font_context.rs
+++ b/servo/components/gfx/platform/freetype/font_context.rs
@@ -1,63 +1,67 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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::heap;
 use freetype::freetype::FT_Add_Default_Modules;
 use freetype::freetype::FT_Done_Library;
 use freetype::freetype::FT_Library;
 use freetype::freetype::FT_Memory;
 use freetype::freetype::FT_MemoryRec_;
 use freetype::freetype::FT_New_Library;
 use heapsize::{HeapSizeOf, heap_size_of};
+use std::heap::{Heap, Alloc, Layout};
 use std::os::raw::{c_long, c_void};
 use std::ptr;
 use std::rc::Rc;
 
 // We pass a |User| struct -- via an opaque |void*| -- to FreeType each time a new instance is
 // created. FreeType passes it back to the ft_alloc/ft_realloc/ft_free callbacks. We use it to
 // record the memory usage of each FreeType instance.
 pub struct User {
     size: usize,
 }
 
 // FreeType doesn't require any particular alignment for allocations.
 const FT_ALIGNMENT: usize = 1;
 
 extern fn ft_alloc(mem: FT_Memory, req_size: c_long) -> *mut c_void {
     unsafe {
-        let ptr = heap::allocate(req_size as usize, FT_ALIGNMENT) as *mut c_void;
+        let layout = Layout::from_size_align(req_size as usize, FT_ALIGNMENT).unwrap();
+        let ptr = Heap.alloc(layout).unwrap() as *mut c_void;
         let actual_size = heap_size_of(ptr as *const _);
 
         let user = (*mem).user as *mut User;
         (*user).size += actual_size;
 
         ptr
     }
 }
 
 extern fn ft_free(mem: FT_Memory, ptr: *mut c_void) {
     unsafe {
         let actual_size = heap_size_of(ptr as *const _);
 
         let user = (*mem).user as *mut User;
         (*user).size -= actual_size;
 
-        heap::deallocate(ptr as *mut u8, actual_size, FT_ALIGNMENT);
+        let layout = Layout::from_size_align(actual_size, FT_ALIGNMENT).unwrap();
+        Heap.dealloc(ptr as *mut u8, layout);
     }
 }
 
 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 new_ptr = heap::reallocate(old_ptr as *mut u8, old_actual_size,
-                                       new_req_size as usize, FT_ALIGNMENT) as *mut c_void;
+        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_actual_size = heap_size_of(new_ptr as *const _);
 
         let user = (*mem).user as *mut User;
         (*user).size += new_actual_size;
         (*user).size -= old_actual_size;
 
         new_ptr
     }
--- a/servo/rust-commit-hash
+++ b/servo/rust-commit-hash
@@ -1,1 +1,1 @@
-3bfc18a9619a5151ff4f11618db9cd882996ba6f
+f85579d4a2c342654f9b158fafd565eb159fdb59