From 5d7e283ead6305b3b44caf212de23594f3a5dd8a 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 32fd5b49f9a..c1865ffa9d9 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 00000000000..542698fd152 --- /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() {}