Skip to content

Commit

Permalink
Stabilize the compile_error_macro feature
Browse files Browse the repository at this point in the history
Stabilizes:

* `compile_error!` as a macro defined by rustc

Closes rust-lang#40872
  • Loading branch information
alexcrichton committed Aug 12, 2017
1 parent 7e22e24 commit febb255
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 52 deletions.
20 changes: 0 additions & 20 deletions src/doc/unstable-book/src/language-features/compile-error.md

This file was deleted.

2 changes: 1 addition & 1 deletion src/libcore/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,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 */ }) }
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,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 */ }) }

Expand Down
1 change: 0 additions & 1 deletion src/libsyntax/ext/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand Down
6 changes: 2 additions & 4 deletions src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 =
Expand Down
10 changes: 0 additions & 10 deletions src/libsyntax_ext/compile_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,13 @@

use syntax::ext::base::*;
use syntax::ext::base;
use syntax::feature_gate;
use syntax_pos::Span;
use syntax::tokenstream;

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,
Expand Down
2 changes: 0 additions & 2 deletions src/test/compile-fail/compile_error_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
13 changes: 0 additions & 13 deletions src/test/compile-fail/feature-gate-compile_error.rs

This file was deleted.

0 comments on commit febb255

Please sign in to comment.