diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2017-07-20 15:50:33 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2017-07-25 07:09:31 -0700 |
| commit | 20b4f86d13b177bf66d1fa4fefbfcc1bb552cb94 (patch) | |
| tree | c53a883de937df40bc562f244fef8c5e5dddc903 /src | |
| parent | daeb6077c87dab99f2d301d06965558b8d064c28 (diff) | |
| download | rust-20b4f86d13b177bf66d1fa4fefbfcc1bb552cb94.tar.gz rust-20b4f86d13b177bf66d1fa4fefbfcc1bb552cb94.zip | |
Stabilize the `compile_error_macro` feature
Stabilizes: * `compile_error!` as a macro defined by rustc Closes #40872
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc/unstable-book/src/language-features/compile-error.md | 20 | ||||
| -rw-r--r-- | src/libcore/macros.rs | 2 | ||||
| -rw-r--r-- | src/libstd/macros.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 1 | ||||
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax_ext/compile_error.rs | 10 | ||||
| -rw-r--r-- | src/test/compile-fail/compile_error_macro.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/feature-gate-compile_error.rs | 13 |
8 files changed, 4 insertions, 52 deletions
diff --git a/src/doc/unstable-book/src/language-features/compile-error.md b/src/doc/unstable-book/src/language-features/compile-error.md deleted file mode 100644 index 4de631e1fb3..00000000000 --- a/src/doc/unstable-book/src/language-features/compile-error.md +++ /dev/null @@ -1,20 +0,0 @@ -# `compile_error` - -The tracking issue for this feature is: [#40872] - -[#40872]: https://github.com/rust-lang/rust/issues/40872 - ------------------------- - -The `compile_error` feature adds a macro which will generate a compilation -error with the specified error message. - -## Examples - -```rust,compile_fail -#![feature(compile_error)] - -fn main() { - compile_error!("The error message"); //ERROR The error message -} -``` diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index ae74016ad74..2edf8e1fa88 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -574,7 +574,7 @@ mod builtin { /// For more information, see the [RFC]. /// /// [RFC]: https://github.com/rust-lang/rfcs/blob/master/text/1695-add-error-macro.md - #[unstable(feature = "compile_error_macro", issue = "40872")] + #[stable(feature = "compile_error_macro", since = "1.20.0")] #[macro_export] #[cfg(dox)] macro_rules! compile_error { ($msg:expr) => ({ /* compiler built-in */ }) } diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index 6ad22820a7d..343c499b3ff 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -249,7 +249,7 @@ pub mod builtin { /// For more information, see the [RFC]. /// /// [RFC]: https://github.com/rust-lang/rfcs/blob/master/text/1695-add-error-macro.md - #[unstable(feature = "compile_error_macro", issue = "40872")] + #[stable(feature = "compile_error_macro", since = "1.20.0")] #[macro_export] macro_rules! compile_error { ($msg:expr) => ({ /* compiler built-in */ }) } diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index dc0848176d6..f6d56557166 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -1041,7 +1041,6 @@ impl<'feat> ExpansionConfig<'feat> { fn enable_allow_internal_unstable = allow_internal_unstable, fn enable_custom_derive = custom_derive, fn proc_macro_enabled = proc_macro, - fn enable_compile_error = compile_error, } } diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 448f95c93a0..e8de8cf41c9 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -117,7 +117,6 @@ macro_rules! declare_features { declare_features! ( (active, asm, "1.0.0", Some(29722)), - (active, compile_error, "1.20.0", Some(40872)), (active, concat_idents, "1.0.0", Some(29599)), (active, link_args, "1.0.0", Some(29596)), (active, log_syntax, "1.0.0", Some(29598)), @@ -445,6 +444,8 @@ declare_features! ( // Allows the definition of associated constants in `trait` or `impl` // blocks. (accepted, associated_consts, "1.20.0", Some(29646)), + // Usage of the `compile_error!` macro + (accepted, compile_error, "1.20.0", Some(40872)), ); // If you change this, please modify src/doc/unstable-book as well. You must @@ -1040,9 +1041,6 @@ pub const EXPLAIN_LOG_SYNTAX: &'static str = pub const EXPLAIN_CONCAT_IDENTS: &'static str = "`concat_idents` is not stable enough for use and is subject to change"; -pub const EXPLAIN_COMPILE_ERROR: &'static str = - "`compile_error` is not stable enough for use and is subject to change"; - pub const EXPLAIN_TRACE_MACROS: &'static str = "`trace_macros` is not stable enough for use and is subject to change"; pub const EXPLAIN_ALLOW_INTERNAL_UNSTABLE: &'static str = diff --git a/src/libsyntax_ext/compile_error.rs b/src/libsyntax_ext/compile_error.rs index bb496716d8c..7bc7afba63c 100644 --- a/src/libsyntax_ext/compile_error.rs +++ b/src/libsyntax_ext/compile_error.rs @@ -12,7 +12,6 @@ use syntax::ext::base::*; use syntax::ext::base; -use syntax::feature_gate; use syntax_pos::Span; use syntax::tokenstream; @@ -20,15 +19,6 @@ pub fn expand_compile_error<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree]) -> Box<base::MacResult + 'cx> { - if !cx.ecfg.enable_compile_error() { - feature_gate::emit_feature_err(&cx.parse_sess, - "compile_error", - sp, - feature_gate::GateIssue::Language, - feature_gate::EXPLAIN_COMPILE_ERROR); - return DummyResult::expr(sp); - } - let var = match get_single_str_from_tts(cx, sp, tts, "compile_error!") { None => return DummyResult::expr(sp), Some(v) => v, diff --git a/src/test/compile-fail/compile_error_macro.rs b/src/test/compile-fail/compile_error_macro.rs index 2a2c3fd8092..e9c5993098c 100644 --- a/src/test/compile-fail/compile_error_macro.rs +++ b/src/test/compile-fail/compile_error_macro.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(compile_error)] - fn main() { compile_error!("a very descriptive error message"); //~ ERROR: a very descriptive error message } diff --git a/src/test/compile-fail/feature-gate-compile_error.rs b/src/test/compile-fail/feature-gate-compile_error.rs deleted file mode 100644 index 545c6852961..00000000000 --- a/src/test/compile-fail/feature-gate-compile_error.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2017 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 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn main() { - compile_error!("test"); //~ ERROR: `compile_error` is not stable enough -} |
