Skip to content

Commit 20b4f86

Browse files
committed
Stabilize the compile_error_macro feature
Stabilizes: * `compile_error!` as a macro defined by rustc Closes #40872
1 parent daeb607 commit 20b4f86

File tree

8 files changed

+4
-52
lines changed

8 files changed

+4
-52
lines changed

src/doc/unstable-book/src/language-features/compile-error.md

-20
This file was deleted.

src/libcore/macros.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ mod builtin {
574574
/// For more information, see the [RFC].
575575
///
576576
/// [RFC]: https://github.com/rust-lang/rfcs/blob/master/text/1695-add-error-macro.md
577-
#[unstable(feature = "compile_error_macro", issue = "40872")]
577+
#[stable(feature = "compile_error_macro", since = "1.20.0")]
578578
#[macro_export]
579579
#[cfg(dox)]
580580
macro_rules! compile_error { ($msg:expr) => ({ /* compiler built-in */ }) }

src/libstd/macros.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ pub mod builtin {
249249
/// For more information, see the [RFC].
250250
///
251251
/// [RFC]: https://github.com/rust-lang/rfcs/blob/master/text/1695-add-error-macro.md
252-
#[unstable(feature = "compile_error_macro", issue = "40872")]
252+
#[stable(feature = "compile_error_macro", since = "1.20.0")]
253253
#[macro_export]
254254
macro_rules! compile_error { ($msg:expr) => ({ /* compiler built-in */ }) }
255255

src/libsyntax/ext/expand.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,6 @@ impl<'feat> ExpansionConfig<'feat> {
10411041
fn enable_allow_internal_unstable = allow_internal_unstable,
10421042
fn enable_custom_derive = custom_derive,
10431043
fn proc_macro_enabled = proc_macro,
1044-
fn enable_compile_error = compile_error,
10451044
}
10461045
}
10471046

src/libsyntax/feature_gate.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ macro_rules! declare_features {
117117

118118
declare_features! (
119119
(active, asm, "1.0.0", Some(29722)),
120-
(active, compile_error, "1.20.0", Some(40872)),
121120
(active, concat_idents, "1.0.0", Some(29599)),
122121
(active, link_args, "1.0.0", Some(29596)),
123122
(active, log_syntax, "1.0.0", Some(29598)),
@@ -445,6 +444,8 @@ declare_features! (
445444
// Allows the definition of associated constants in `trait` or `impl`
446445
// blocks.
447446
(accepted, associated_consts, "1.20.0", Some(29646)),
447+
// Usage of the `compile_error!` macro
448+
(accepted, compile_error, "1.20.0", Some(40872)),
448449
);
449450

450451
// 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 =
10401041
pub const EXPLAIN_CONCAT_IDENTS: &'static str =
10411042
"`concat_idents` is not stable enough for use and is subject to change";
10421043

1043-
pub const EXPLAIN_COMPILE_ERROR: &'static str =
1044-
"`compile_error` is not stable enough for use and is subject to change";
1045-
10461044
pub const EXPLAIN_TRACE_MACROS: &'static str =
10471045
"`trace_macros` is not stable enough for use and is subject to change";
10481046
pub const EXPLAIN_ALLOW_INTERNAL_UNSTABLE: &'static str =

src/libsyntax_ext/compile_error.rs

-10
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,13 @@
1212

1313
use syntax::ext::base::*;
1414
use syntax::ext::base;
15-
use syntax::feature_gate;
1615
use syntax_pos::Span;
1716
use syntax::tokenstream;
1817

1918
pub fn expand_compile_error<'cx>(cx: &'cx mut ExtCtxt,
2019
sp: Span,
2120
tts: &[tokenstream::TokenTree])
2221
-> Box<base::MacResult + 'cx> {
23-
if !cx.ecfg.enable_compile_error() {
24-
feature_gate::emit_feature_err(&cx.parse_sess,
25-
"compile_error",
26-
sp,
27-
feature_gate::GateIssue::Language,
28-
feature_gate::EXPLAIN_COMPILE_ERROR);
29-
return DummyResult::expr(sp);
30-
}
31-
3222
let var = match get_single_str_from_tts(cx, sp, tts, "compile_error!") {
3323
None => return DummyResult::expr(sp),
3424
Some(v) => v,

src/test/compile-fail/compile_error_macro.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(compile_error)]
12-
1311
fn main() {
1412
compile_error!("a very descriptive error message"); //~ ERROR: a very descriptive error message
1513
}

src/test/compile-fail/feature-gate-compile_error.rs

-13
This file was deleted.

0 commit comments

Comments
 (0)