about summary refs log tree commit diff
path: root/src/doc
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-06-17 16:00:04 -0700
committerPatrick Walton <pcwalton@mimiga.net>2014-06-20 14:24:31 -0700
commitdcbf4ec2a1cfd9f521c96b9dab62a2d27ded1b24 (patch)
treec8a77671439e27d37b6432d25009a3549f02ec67 /src/doc
parent6750eb5a05042fe3fb84708909074f33ad86d3ec (diff)
librustc: Put `#[unsafe_destructor]` behind a feature gate.
Closes #8142.

This is not the semantics we want long-term. You can continue to use
`#[unsafe_destructor]`, but you'll need to add
`#![feature(unsafe_destructor)]` to the crate attributes.

[breaking-change]
Diffstat (limited to 'src/doc')
-rw-r--r--src/doc/guide-unsafe.md8
-rw-r--r--src/doc/rust.md5
2 files changed, 9 insertions, 4 deletions
diff --git a/src/doc/guide-unsafe.md b/src/doc/guide-unsafe.md
index 1431c8a5c9a..def96c62deb 100644
--- a/src/doc/guide-unsafe.md
+++ b/src/doc/guide-unsafe.md
@@ -192,6 +192,8 @@ As an example, we give a reimplementation of owned boxes by wrapping
 reimplementation is as safe as the `Box` type.
 
 ```
+#![feature(unsafe_destructor)]
+
 extern crate libc;
 use libc::{c_void, size_t, malloc, free};
 use std::mem;
@@ -242,10 +244,12 @@ impl<T: Send> Unique<T> {
 // A key ingredient for safety, we associate a destructor with
 // Unique<T>, making the struct manage the raw pointer: when the
 // struct goes out of scope, it will automatically free the raw pointer.
+//
 // NB: This is an unsafe destructor, because rustc will not normally
-// allow destructors to be associated with parametrized types, due to
+// allow destructors to be associated with parameterized types, due to
 // bad interaction with managed boxes. (With the Send restriction,
-// we don't have this problem.)
+// we don't have this problem.) Note that the `#[unsafe_destructor]`
+// feature gate is required to use unsafe destructors.
 #[unsafe_destructor]
 impl<T: Send> Drop for Unique<T> {
     fn drop(&mut self) {
diff --git a/src/doc/rust.md b/src/doc/rust.md
index 7e5e5b2e67a..ca5ecc191cc 100644
--- a/src/doc/rust.md
+++ b/src/doc/rust.md
@@ -1940,12 +1940,13 @@ interpreted:
   enum representation in C is undefined, and this may be incorrect when the C
   code is compiled with certain flags.
 - `simd` - on certain tuple structs, derive the arithmetic operators, which
-  lower to the target's SIMD instructions, if any.
+  lower to the target's SIMD instructions, if any; the `simd` feature gate
+  is necessary to use this attribute.
 - `static_assert` - on statics whose type is `bool`, terminates compilation
   with an error if it is not initialized to `true`.
 - `unsafe_destructor` - allow implementations of the "drop" language item
   where the type it is implemented for does not implement the "send" language
-  item.
+  item; the `unsafe_destructor` feature gate is needed to use this attribute
 - `unsafe_no_drop_flag` - on structs, remove the flag that prevents
   destructors from being run twice. Destructors might be run multiple times on
   the same object with this attribute.