]> git.proxmox.com Git - rustc.git/blobdiff - src/doc/nomicon/destructors.md
Imported Upstream version 1.6.0+dfsg1
[rustc.git] / src / doc / nomicon / destructors.md
index 604370b636517c8216c9c7fcaf5e169758536ef2..c6fa5b079db02343b4e3a13997dc030795f68cc4 100644 (file)
@@ -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;