diff --git a/destructors.md b/destructors.md index 604370b..c6fa5b0 100644 --- a/destructors.md +++ b/destructors.md @@ -26,12 +26,11 @@ this is totally fine. For instance, a custom implementation of `Box` might write `Drop` like this: ```rust -#![feature(alloc, heap_api, core_intrinsics, unique)] +#![feature(alloc, heap_api, drop_in_place, unique)] extern crate alloc; -use std::ptr::Unique; -use std::intrinsics::drop_in_place; +use std::ptr::{drop_in_place, Unique}; use std::mem; use alloc::heap; @@ -58,12 +57,11 @@ use-after-free the `ptr` because when drop exits, it becomes inaccessible. However this wouldn't work: ```rust -#![feature(alloc, heap_api, core_intrinsics, unique)] +#![feature(alloc, heap_api, drop_in_place, unique)] extern crate alloc; -use std::ptr::Unique; -use std::intrinsics::drop_in_place; +use std::ptr::{drop_in_place, Unique}; use std::mem; use alloc::heap; @@ -137,12 +135,11 @@ The classic safe solution to overriding recursive drop and allowing moving out of Self during `drop` is to use an Option: ```rust -#![feature(alloc, heap_api, core_intrinsics, unique)] +#![feature(alloc, heap_api, drop_in_place, unique)] extern crate alloc; -use std::ptr::Unique; -use std::intrinsics::drop_in_place; +use std::ptr::{drop_in_place, Unique}; use std::mem; use alloc::heap;