Gate format_args_nll behind feature flag
This commit is contained in:
@@ -413,7 +413,7 @@ pub mod builtin {
|
||||
///
|
||||
/// [`format_args`]: ../std/macro.format_args.html
|
||||
#[doc(hidden)]
|
||||
#[unstable(feature = "println_format_args", issue="0")]
|
||||
#[unstable(feature = "format_args_nl", issue="0")]
|
||||
#[macro_export]
|
||||
macro_rules! format_args_nl {
|
||||
($fmt:expr) => ({ /* compiler built-in */ });
|
||||
|
||||
@@ -1592,6 +1592,7 @@ impl<'feat> ExpansionConfig<'feat> {
|
||||
fn enable_trace_macros = trace_macros,
|
||||
fn enable_allow_internal_unstable = allow_internal_unstable,
|
||||
fn enable_custom_derive = custom_derive,
|
||||
fn enable_format_args_nl = format_args_nl,
|
||||
fn use_extern_macros_enabled = use_extern_macros,
|
||||
fn macros_in_extern_enabled = macros_in_extern,
|
||||
fn proc_macro_mod = proc_macro_mod,
|
||||
|
||||
@@ -129,6 +129,7 @@ declare_features! (
|
||||
// rustc internal, for now:
|
||||
(active, intrinsics, "1.0.0", None, None),
|
||||
(active, lang_items, "1.0.0", None, None),
|
||||
(active, format_args_nl, "1.29.0", None, None),
|
||||
|
||||
(active, link_llvm_intrinsics, "1.0.0", Some(29602), None),
|
||||
(active, linkage, "1.0.0", Some(29603), None),
|
||||
@@ -1327,6 +1328,9 @@ 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_FORMAT_ARGS_NL: &'static str =
|
||||
"`format_args_nl` is only for internal language 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 =
|
||||
|
||||
@@ -17,6 +17,7 @@ use syntax::ast;
|
||||
use syntax::ext::base::*;
|
||||
use syntax::ext::base;
|
||||
use syntax::ext::build::AstBuilder;
|
||||
use syntax::feature_gate;
|
||||
use syntax::parse::token;
|
||||
use syntax::ptr::P;
|
||||
use syntax::symbol::Symbol;
|
||||
@@ -693,6 +694,20 @@ pub fn expand_format_args_nl<'cx>(ecx: &'cx mut ExtCtxt,
|
||||
mut sp: Span,
|
||||
tts: &[tokenstream::TokenTree])
|
||||
-> Box<dyn base::MacResult + 'cx> {
|
||||
//if !ecx.ecfg.enable_allow_internal_unstable() {
|
||||
|
||||
// For some reason, the only one that actually works for `println` is the first check
|
||||
if !sp.allows_unstable() // the enclosing span is marked as `#[allow_insternal_unsable]`
|
||||
|| !ecx.ecfg.enable_allow_internal_unstable() // NOTE: when is this enabled?
|
||||
|| !ecx.ecfg.enable_format_args_nl() // enabled using `#[feature(format_args_nl]`
|
||||
{
|
||||
feature_gate::emit_feature_err(&ecx.parse_sess,
|
||||
"format_args_nl",
|
||||
sp,
|
||||
feature_gate::GateIssue::Language,
|
||||
feature_gate::EXPLAIN_FORMAT_ARGS_NL);
|
||||
return base::DummyResult::expr(sp);
|
||||
}
|
||||
sp = sp.apply_mark(ecx.current_expansion.mark);
|
||||
match parse_args(ecx, sp, tts) {
|
||||
Some((efmt, args, names)) => {
|
||||
|
||||
Reference in New Issue
Block a user