diff options
| author | Dan Aloni <alonid@gmail.com> | 2018-11-19 16:32:18 +0200 |
|---|---|---|
| committer | Dan Aloni <alonid@gmail.com> | 2018-11-21 21:31:46 +0200 |
| commit | fc284c1eee0180903fe11463dcee06e414202cf7 (patch) | |
| tree | 2fe1bd7e903b7c03f05582ef34d435ca7a398f85 /src/libsyntax/ext/tt | |
| parent | 910ec6d97ff03549c22352d7763be02b60d73470 (diff) | |
| download | rust-fc284c1eee0180903fe11463dcee06e414202cf7.tar.gz rust-fc284c1eee0180903fe11463dcee06e414202cf7.zip | |
Stabilize macro_literal_matcher
Diffstat (limited to 'src/libsyntax/ext/tt')
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 6bba891278a..55c1904bd27 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -19,7 +19,7 @@ use ext::tt::macro_parser::{MatchedSeq, MatchedNonterminal}; use ext::tt::macro_parser::{parse, parse_failure_msg}; use ext::tt::quoted; use ext::tt::transcribe::transcribe; -use feature_gate::{self, emit_feature_err, Features, GateIssue}; +use feature_gate::Features; use parse::{Directory, ParseSess}; use parse::parser::Parser; use parse::token::{self, NtTT}; @@ -1027,26 +1027,21 @@ fn has_legal_fragment_specifier(sess: &ParseSess, Ok(()) } -fn is_legal_fragment_specifier(sess: &ParseSess, - features: &Features, - attrs: &[ast::Attribute], +fn is_legal_fragment_specifier(_sess: &ParseSess, + _features: &Features, + _attrs: &[ast::Attribute], frag_name: &str, - frag_span: Span) -> bool { + _frag_span: Span) -> bool { + /* + * If new fragmnet specifiers are invented in nightly, `_sess`, + * `_features`, `_attrs`, and `_frag_span` will be useful for + * here for checking against feature gates. See past versions of + * this function. + */ match frag_name { "item" | "block" | "stmt" | "expr" | "pat" | "lifetime" | - "path" | "ty" | "ident" | "meta" | "tt" | "vis" | "" => true, - "literal" => { - if !features.macro_literal_matcher && - !attr::contains_name(attrs, "allow_internal_unstable") { - let explain = feature_gate::EXPLAIN_LITERAL_MATCHER; - emit_feature_err(sess, - "macro_literal_matcher", - frag_span, - GateIssue::Language, - explain); - } - true - }, + "path" | "ty" | "ident" | "meta" | "tt" | "vis" | "literal" | + "" => true, _ => false, } } |
