]> git.lizzy.rs Git - rust.git/commitdiff
Feature-gate the `#[unsafe_no_drop_flag]` attribute.
authorFelix S. Klock II <pnkfelix@pnkfx.org>
Wed, 11 Feb 2015 12:57:40 +0000 (13:57 +0100)
committerFelix S. Klock II <pnkfelix@pnkfx.org>
Wed, 11 Feb 2015 12:57:40 +0000 (13:57 +0100)
See RFC 320, "Non-zeroing dynamic drops."

Fix #22173

[breaking-change]

src/liballoc/lib.rs
src/libcollections/lib.rs
src/libstd/lib.rs
src/libsyntax/feature_gate.rs
src/test/auxiliary/issue-10028.rs
src/test/run-pass/attr-no-drop-flag-size.rs
src/test/run-pass/issue-10734.rs
src/test/run-pass/zero-size-type-destructors.rs

index 0e6266f9cbc578f395c255e20df4bb322d8ab79d..87106041c69d7f213e903aab58a791ca3a780bf1 100644 (file)
@@ -71,6 +71,7 @@
 #![feature(box_syntax)]
 #![feature(optin_builtin_traits)]
 #![feature(unboxed_closures)]
+#![feature(unsafe_no_drop_flag)]
 #![feature(core)]
 #![feature(hash)]
 #![cfg_attr(all(not(feature = "external_funcs"), not(feature = "external_crate")),
index a542ee5d47d36c84c14175fc6a63cafdbbf8d950..8e73a0c9f804c94cb5fcf9073f7eeb33d60a92bb 100644 (file)
 #![feature(box_syntax)]
 #![feature(core)]
 #![feature(hash)]
+#![feature(slicing_syntax)]
 #![feature(staged_api)]
 #![feature(unboxed_closures)]
 #![feature(unicode)]
-#![feature(unsafe_destructor, slicing_syntax)]
+#![feature(unsafe_destructor)]
+#![feature(unsafe_no_drop_flag)]
 #![cfg_attr(test, feature(rand, rustc_private, test))]
 #![cfg_attr(test, allow(deprecated))] // rand
 
index 967789dd41144bcbec8ed4505724581f000b71e4..429b1324f9713ea6d10dcef9ad0edd983e7c0ca4 100644 (file)
 #![feature(core)]
 #![feature(hash)]
 #![feature(int_uint)]
-#![feature(lang_items, unsafe_destructor)]
+#![feature(lang_items)]
 #![feature(libc)]
 #![feature(linkage, thread_local, asm)]
 #![feature(old_impl_check)]
 #![feature(staged_api)]
 #![feature(unboxed_closures)]
 #![feature(unicode)]
+#![feature(unsafe_destructor)]
+#![feature(unsafe_no_drop_flag)]
 #![feature(macro_reexport)]
 #![cfg_attr(test, feature(test))]
 
index 72bbe1adfaa123730558b895fdcadad0d63ccc0e..e3b9402ba3008ca5e7051dbad2db354a74084e71 100644 (file)
 
     // Allows using #![no_std]
     ("no_std", "1.0.0", Active),
+
+    // Allows using the unsafe_no_drop_flag attribute (unlikely to
+    // switch to Accepted; see RFC 320)
+    ("unsafe_no_drop_flag", "1.0.0", Active),
 ];
 
 enum Status {
@@ -474,6 +478,12 @@ fn visit_attribute(&mut self, attr: &ast::Attribute) {
             self.gate_feature("no_std", attr.span,
                               "no_std is experimental");
         }
+
+        if attr.check_name("unsafe_no_drop_flag") {
+            self.gate_feature("unsafe_no_drop_flag", attr.span,
+                              "unsafe_no_drop_flag has unstable semantics \
+                               and may be removed in the future");
+        }
     }
 
     fn visit_pat(&mut self, pattern: &ast::Pat) {
index 00fdb3e40b975b6203d67279a064f8ae964fce32..a21deb44fcc834e7023a866f042686fb1f40f40a 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(unsafe_no_drop_flag)]
+
 #[unsafe_no_drop_flag]
 pub struct ZeroLengthThingWithDestructor;
 impl Drop for ZeroLengthThingWithDestructor {
index b3fb162790072d2168e0a37aea7f68b6b551d422..bd799917842b124881ebc58b2c95fd5b1c66a5b9 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 #![feature(unsafe_destructor)]
+#![feature(unsafe_no_drop_flag)]
 
 use std::mem::size_of;
 
index 1c267f48337525910e2dc6858c01d824721471bc..a6af2327c9e8096f73cea2876aadb63e41742a2f 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(unsafe_no_drop_flag)]
+
 static mut drop_count: uint = 0;
 
 #[unsafe_no_drop_flag]
index fd272a47de9c25736f4cd91d6800b13e598a63cd..f4d03a5cda400aa603017f7d5d7b22daab2e97a2 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(unsafe_no_drop_flag)]
+
 static mut destructions : int = 3;
 
 pub fn foo() {