Skip to content

Feature-gate the #[unsafe_no_drop_flag] attribute. #22178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 12, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/liballoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")),
Expand Down
4 changes: 3 additions & 1 deletion src/libcollections/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion src/libstd/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -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))]

Expand Down
10 changes: 10 additions & 0 deletions src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions src/test/auxiliary/issue-10028.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions src/test/run-pass/attr-no-drop-flag-size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

#![feature(unsafe_destructor)]
#![feature(unsafe_no_drop_flag)]

use std::mem::size_of;

Expand Down
2 changes: 2 additions & 0 deletions src/test/run-pass/issue-10734.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 2 additions & 0 deletions src/test/run-pass/zero-size-type-destructors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down