diff options
| author | Esteban Küber <esteban@commure.com> | 2018-07-21 15:50:46 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@commure.com> | 2018-07-21 15:50:46 -0700 |
| commit | 00d500052c72775ab994b5634195976f85b4e0d6 (patch) | |
| tree | 09fe2165eefbbe1b7ff0e249cc56ebc9538142cb /src/libsyntax_ext | |
| parent | 83a8af50bbf704b5cdf2cbbab481e0e936ed03a8 (diff) | |
| download | rust-00d500052c72775ab994b5634195976f85b4e0d6.tar.gz rust-00d500052c72775ab994b5634195976f85b4e0d6.zip | |
Gate `format_args_nll` behind feature flag
Diffstat (limited to 'src/libsyntax_ext')
| -rw-r--r-- | src/libsyntax_ext/format.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libsyntax_ext/format.rs b/src/libsyntax_ext/format.rs index 9f153c36733..5b8f059fd14 100644 --- a/src/libsyntax_ext/format.rs +++ b/src/libsyntax_ext/format.rs @@ -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)) => { |
