diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2015-02-11 13:57:40 +0100 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2015-02-11 13:57:40 +0100 |
| commit | f9a1087f2730ab021d5356a5df703baeccffc020 (patch) | |
| tree | f72d08a0947b2144e09b34066afa46d2ec3d032c | |
| parent | 0047f8bbd8f94c7ba54d42eb7272c89a48d6ae54 (diff) | |
| download | rust-f9a1087f2730ab021d5356a5df703baeccffc020.tar.gz rust-f9a1087f2730ab021d5356a5df703baeccffc020.zip | |
Feature-gate the `#[unsafe_no_drop_flag]` attribute.
See RFC 320, "Non-zeroing dynamic drops." Fix #22173 [breaking-change]
| -rw-r--r-- | src/liballoc/lib.rs | 1 | ||||
| -rw-r--r-- | src/libcollections/lib.rs | 4 | ||||
| -rw-r--r-- | src/libstd/lib.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 10 | ||||
| -rw-r--r-- | src/test/auxiliary/issue-10028.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/attr-no-drop-flag-size.rs | 1 | ||||
| -rw-r--r-- | src/test/run-pass/issue-10734.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/zero-size-type-destructors.rs | 2 |
8 files changed, 24 insertions, 2 deletions
diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 0e6266f9cbc..87106041c69 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -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")), diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index a542ee5d47d..8e73a0c9f80 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -26,10 +26,12 @@ #![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 diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 967789dd411..429b1324f97 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -111,7 +111,7 @@ #![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)] @@ -120,6 +120,8 @@ #![feature(staged_api)] #![feature(unboxed_closures)] #![feature(unicode)] +#![feature(unsafe_destructor)] +#![feature(unsafe_no_drop_flag)] #![feature(macro_reexport)] #![cfg_attr(test, feature(test))] diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 72bbe1adfaa..e3b9402ba30 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -126,6 +126,10 @@ static KNOWN_FEATURES: &'static [(&'static str, &'static str, Status)] = &[ // 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 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> { 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) { diff --git a/src/test/auxiliary/issue-10028.rs b/src/test/auxiliary/issue-10028.rs index 00fdb3e40b9..a21deb44fcc 100644 --- a/src/test/auxiliary/issue-10028.rs +++ b/src/test/auxiliary/issue-10028.rs @@ -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 { diff --git a/src/test/run-pass/attr-no-drop-flag-size.rs b/src/test/run-pass/attr-no-drop-flag-size.rs index b3fb1627900..bd799917842 100644 --- a/src/test/run-pass/attr-no-drop-flag-size.rs +++ b/src/test/run-pass/attr-no-drop-flag-size.rs @@ -9,6 +9,7 @@ // except according to those terms. #![feature(unsafe_destructor)] +#![feature(unsafe_no_drop_flag)] use std::mem::size_of; diff --git a/src/test/run-pass/issue-10734.rs b/src/test/run-pass/issue-10734.rs index 1c267f48337..a6af2327c9e 100644 --- a/src/test/run-pass/issue-10734.rs +++ b/src/test/run-pass/issue-10734.rs @@ -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] diff --git a/src/test/run-pass/zero-size-type-destructors.rs b/src/test/run-pass/zero-size-type-destructors.rs index fd272a47de9..f4d03a5cda4 100644 --- a/src/test/run-pass/zero-size-type-destructors.rs +++ b/src/test/run-pass/zero-size-type-destructors.rs @@ -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() { |
