From 5aa2345269042e9af3224df3636bed64064dd792 Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Tue, 13 Feb 2018 08:53:05 -0500 Subject: [PATCH] Fix code example compilation errors related to `unique`. --- src/destructors.md | 6 +++--- src/vec-final.md | 1 + src/vec-layout.md | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/destructors.md b/src/destructors.md index ce1405e..6656747 100644 --- a/src/destructors.md +++ b/src/destructors.md @@ -26,7 +26,7 @@ this is totally fine. For instance, a custom implementation of `Box` might write `Drop` like this: ```rust -#![feature(ptr_internals, allocator_api)] +#![feature(ptr_internals, allocator_api, unique)] use std::heap::{Heap, Alloc, Layout}; use std::mem; @@ -52,7 +52,7 @@ use-after-free the `ptr` because when drop exits, it becomes inaccessible. However this wouldn't work: ```rust -#![feature(allocator_api, ptr_internals)] +#![feature(allocator_api, ptr_internals, unique)] use std::heap::{Heap, Alloc, Layout}; use std::ptr::{drop_in_place, Unique}; @@ -123,7 +123,7 @@ The classic safe solution to overriding recursive drop and allowing moving out of Self during `drop` is to use an Option: ```rust -#![feature(allocator_api, ptr_internals)] +#![feature(allocator_api, ptr_internals, unique)] use std::heap::{Alloc, Heap, Layout}; use std::ptr::{drop_in_place, Unique}; diff --git a/src/vec-final.md b/src/vec-final.md index 772e2a5..70a7a6b 100644 --- a/src/vec-final.md +++ b/src/vec-final.md @@ -3,6 +3,7 @@ ```rust #![feature(ptr_internals)] #![feature(allocator_api)] +#![feature(unique)] use std::ptr::{Unique, self}; use std::mem; diff --git a/src/vec-layout.md b/src/vec-layout.md index c9962e2..286682f 100644 --- a/src/vec-layout.md +++ b/src/vec-layout.md @@ -71,7 +71,7 @@ take the hit and use std's Unique: ```rust -#![feature(ptr_internals)] +#![feature(ptr_internals, unique)] use std::ptr::{Unique, self};