Skip to content

Commit f9a1087

Browse files
committed
Feature-gate the #[unsafe_no_drop_flag] attribute.
See RFC 320, "Non-zeroing dynamic drops." Fix rust-lang#22173 [breaking-change]
1 parent 0047f8b commit f9a1087

File tree

8 files changed

+24
-2
lines changed

8 files changed

+24
-2
lines changed

src/liballoc/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
#![feature(box_syntax)]
7272
#![feature(optin_builtin_traits)]
7373
#![feature(unboxed_closures)]
74+
#![feature(unsafe_no_drop_flag)]
7475
#![feature(core)]
7576
#![feature(hash)]
7677
#![cfg_attr(all(not(feature = "external_funcs"), not(feature = "external_crate")),

src/libcollections/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@
2626
#![feature(box_syntax)]
2727
#![feature(core)]
2828
#![feature(hash)]
29+
#![feature(slicing_syntax)]
2930
#![feature(staged_api)]
3031
#![feature(unboxed_closures)]
3132
#![feature(unicode)]
32-
#![feature(unsafe_destructor, slicing_syntax)]
33+
#![feature(unsafe_destructor)]
34+
#![feature(unsafe_no_drop_flag)]
3335
#![cfg_attr(test, feature(rand, rustc_private, test))]
3436
#![cfg_attr(test, allow(deprecated))] // rand
3537

src/libstd/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
#![feature(core)]
112112
#![feature(hash)]
113113
#![feature(int_uint)]
114-
#![feature(lang_items, unsafe_destructor)]
114+
#![feature(lang_items)]
115115
#![feature(libc)]
116116
#![feature(linkage, thread_local, asm)]
117117
#![feature(old_impl_check)]
@@ -120,6 +120,8 @@
120120
#![feature(staged_api)]
121121
#![feature(unboxed_closures)]
122122
#![feature(unicode)]
123+
#![feature(unsafe_destructor)]
124+
#![feature(unsafe_no_drop_flag)]
123125
#![feature(macro_reexport)]
124126
#![cfg_attr(test, feature(test))]
125127

src/libsyntax/feature_gate.rs

+10
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ static KNOWN_FEATURES: &'static [(&'static str, &'static str, Status)] = &[
126126

127127
// Allows using #![no_std]
128128
("no_std", "1.0.0", Active),
129+
130+
// Allows using the unsafe_no_drop_flag attribute (unlikely to
131+
// switch to Accepted; see RFC 320)
132+
("unsafe_no_drop_flag", "1.0.0", Active),
129133
];
130134

131135
enum Status {
@@ -474,6 +478,12 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
474478
self.gate_feature("no_std", attr.span,
475479
"no_std is experimental");
476480
}
481+
482+
if attr.check_name("unsafe_no_drop_flag") {
483+
self.gate_feature("unsafe_no_drop_flag", attr.span,
484+
"unsafe_no_drop_flag has unstable semantics \
485+
and may be removed in the future");
486+
}
477487
}
478488

479489
fn visit_pat(&mut self, pattern: &ast::Pat) {

src/test/auxiliary/issue-10028.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![feature(unsafe_no_drop_flag)]
12+
1113
#[unsafe_no_drop_flag]
1214
pub struct ZeroLengthThingWithDestructor;
1315
impl Drop for ZeroLengthThingWithDestructor {

src/test/run-pass/attr-no-drop-flag-size.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
#![feature(unsafe_destructor)]
12+
#![feature(unsafe_no_drop_flag)]
1213

1314
use std::mem::size_of;
1415

src/test/run-pass/issue-10734.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![feature(unsafe_no_drop_flag)]
12+
1113
static mut drop_count: uint = 0;
1214

1315
#[unsafe_no_drop_flag]

src/test/run-pass/zero-size-type-destructors.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![feature(unsafe_no_drop_flag)]
12+
1113
static mut destructions : int = 3;
1214

1315
pub fn foo() {

0 commit comments

Comments
 (0)