From 416daac613efa636eb928a45fd810228abf74102 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Wed, 25 Feb 2015 01:35:41 +0100 Subject: [PATCH] Turn `unsafe_no_drop_flag` back into a gated-feature. Fix #22173 --- src/libsyntax/feature_gate.rs | 4 +++- .../compile-fail/unsafe_no_drop_flag-gate.rs | 23 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 src/test/compile-fail/unsafe_no_drop_flag-gate.rs diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 32fd5b49f9a44..c1865ffa9d9a1 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -243,7 +243,9 @@ pub static KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[ ("static_assert", Whitelisted), ("no_debug", Whitelisted), ("omit_gdb_pretty_printer_section", Whitelisted), - ("unsafe_no_drop_flag", Whitelisted), + ("unsafe_no_drop_flag", Gated("unsafe_no_drop_flag", + "unsafe_no_drop_flag has unstable semantics \ + and may be removed in the future")), // used in resolve ("prelude_import", Whitelisted), diff --git a/src/test/compile-fail/unsafe_no_drop_flag-gate.rs b/src/test/compile-fail/unsafe_no_drop_flag-gate.rs new file mode 100644 index 0000000000000..542698fd15295 --- /dev/null +++ b/src/test/compile-fail/unsafe_no_drop_flag-gate.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub struct T; + +#[unsafe_no_drop_flag] +//~^ ERROR unsafe_no_drop_flag has unstable semantics and may be removed +pub struct S { + pub x: T, +} + +impl Drop for S { + fn drop(&mut self) {} +} + +pub fn main() {}