Skip to content

Commit

Permalink
Auto merge of #17714 - servo:rustup, r=SimonSapin
Browse files Browse the repository at this point in the history
Update to rustc 1.20.0-nightly (f85579d4a 2017-07-12)

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17714)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Jul 13, 2017
2 parents 14d5e4c + db1a3e5 commit 51c9495
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
9 changes: 2 additions & 7 deletions components/gfx/lib.rs
Expand Up @@ -3,19 +3,14 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// For SIMD
#![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))]
#![cfg_attr(any(target_os = "linux", target_os = "android"), feature(allocator_api))]
#![feature(box_syntax)]
#![feature(cfg_target_feature)]
#![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;
Expand Down
14 changes: 9 additions & 5 deletions components/gfx/platform/freetype/font_context.rs
Expand Up @@ -2,14 +2,14 @@
* 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;
Expand All @@ -26,7 +26,8 @@ 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;
Expand All @@ -43,16 +44,19 @@ extern fn ft_free(mem: FT_Memory, ptr: *mut c_void) {
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;
Expand Down
2 changes: 1 addition & 1 deletion rust-commit-hash
@@ -1 +1 @@
3bfc18a9619a5151ff4f11618db9cd882996ba6f
f85579d4a2c342654f9b158fafd565eb159fdb59

0 comments on commit 51c9495

Please sign in to comment.