Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to remove Opaque type and fix on nightly #2

Merged
merged 1 commit into from
Aug 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![feature(allocator_api)]

use std::alloc::{GlobalAlloc, Layout, Opaque};
use std::alloc::{GlobalAlloc, Layout};

use std::os::raw::c_void;

Expand All @@ -15,11 +15,11 @@ extern "C" {
pub struct TCMalloc;

unsafe impl GlobalAlloc for TCMalloc {
unsafe fn alloc(&self, layout: Layout) -> *mut Opaque {
tc_memalign(layout.align(), layout.size()) as *mut Opaque
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
tc_memalign(layout.align(), layout.size()) as *mut u8
}

unsafe fn dealloc(&self, ptr: *mut Opaque, _layout: Layout) {
unsafe fn dealloc(&self, ptr: *mut u8, _layout: Layout) {
tc_free(ptr as *mut c_void);
// tc_free_sized(ptr as *mut c_void, layout.size());
}
Expand Down