about summary refs log tree commit diff
path: root/src/doc
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2018-04-03 17:12:57 +0200
committerSimon Sapin <simon.sapin@exyr.org>2018-04-12 22:53:12 +0200
commit86753ce1cc520bfe50ae89f09ec47f313ce900eb (patch)
tree5611452336d4e8dbf10c2f21b9516d46743092f8 /src/doc
parenteb69593f73be1e41d9e2ef065010a47478c14924 (diff)
downloadrust-86753ce1cc520bfe50ae89f09ec47f313ce900eb.tar.gz
rust-86753ce1cc520bfe50ae89f09ec47f313ce900eb.zip
Use the GlobalAlloc trait for #[global_allocator]
Diffstat (limited to 'src/doc')
-rw-r--r--src/doc/unstable-book/src/language-features/global-allocator.md8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/doc/unstable-book/src/language-features/global-allocator.md b/src/doc/unstable-book/src/language-features/global-allocator.md
index b3e6925b666..6ce12ba684d 100644
--- a/src/doc/unstable-book/src/language-features/global-allocator.md
+++ b/src/doc/unstable-book/src/language-features/global-allocator.md
@@ -29,16 +29,16 @@ looks like:
 ```rust
 #![feature(global_allocator, allocator_api, heap_api)]
 
-use std::heap::{Alloc, System, Layout, AllocErr};
+use std::alloc::{GlobalAlloc, System, Layout, Void};
 
 struct MyAllocator;
 
-unsafe impl<'a> Alloc for &'a MyAllocator {
-    unsafe fn alloc(&mut self, layout: Layout) -> Result<*mut u8, AllocErr> {
+unsafe impl GlobalAlloc for MyAllocator {
+    unsafe fn alloc(&self, layout: Layout) -> *mut Void {
         System.alloc(layout)
     }
 
-    unsafe fn dealloc(&mut self, ptr: *mut u8, layout: Layout) {
+    unsafe fn dealloc(&self, ptr: *mut Void, layout: Layout) {
         System.dealloc(ptr, layout)
     }
 }