Skip to content

Commit b16d8eb

Browse files
authored
Rollup merge of rust-lang#56072 - da-x:stabilize-literal-matcher, r=petrochenkov
Stabilize macro_literal_matcher This followed FCP in rust-lang#35625. Closes rust-lang#35625
2 parents 6c2513c + b8ae7b8 commit b16d8eb

File tree

7 files changed

+15
-73
lines changed

7 files changed

+15
-73
lines changed

src/doc/unstable-book/src/language-features/macro-literal-matcher.md

-17
This file was deleted.

src/libsyntax/ext/tt/macro_rules.rs

+13-18
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use ext::tt::macro_parser::{MatchedSeq, MatchedNonterminal};
1919
use ext::tt::macro_parser::{parse, parse_failure_msg};
2020
use ext::tt::quoted;
2121
use ext::tt::transcribe::transcribe;
22-
use feature_gate::{self, emit_feature_err, Features, GateIssue};
22+
use feature_gate::Features;
2323
use parse::{Directory, ParseSess};
2424
use parse::parser::Parser;
2525
use parse::token::{self, NtTT};
@@ -1027,26 +1027,21 @@ fn has_legal_fragment_specifier(sess: &ParseSess,
10271027
Ok(())
10281028
}
10291029

1030-
fn is_legal_fragment_specifier(sess: &ParseSess,
1031-
features: &Features,
1032-
attrs: &[ast::Attribute],
1030+
fn is_legal_fragment_specifier(_sess: &ParseSess,
1031+
_features: &Features,
1032+
_attrs: &[ast::Attribute],
10331033
frag_name: &str,
1034-
frag_span: Span) -> bool {
1034+
_frag_span: Span) -> bool {
1035+
/*
1036+
* If new fragment specifiers are invented in nightly, `_sess`,
1037+
* `_features`, `_attrs`, and `_frag_span` will be useful here
1038+
* for checking against feature gates. See past versions of
1039+
* this function.
1040+
*/
10351041
match frag_name {
10361042
"item" | "block" | "stmt" | "expr" | "pat" | "lifetime" |
1037-
"path" | "ty" | "ident" | "meta" | "tt" | "vis" | "" => true,
1038-
"literal" => {
1039-
if !features.macro_literal_matcher &&
1040-
!attr::contains_name(attrs, "allow_internal_unstable") {
1041-
let explain = feature_gate::EXPLAIN_LITERAL_MATCHER;
1042-
emit_feature_err(sess,
1043-
"macro_literal_matcher",
1044-
frag_span,
1045-
GateIssue::Language,
1046-
explain);
1047-
}
1048-
true
1049-
},
1043+
"path" | "ty" | "ident" | "meta" | "tt" | "vis" | "literal" |
1044+
"" => true,
10501045
_ => false,
10511046
}
10521047
}

src/libsyntax/feature_gate.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,6 @@ declare_features! (
436436
// Allows irrefutable patterns in if-let and while-let statements (RFC 2086)
437437
(active, irrefutable_let_patterns, "1.27.0", Some(44495), None),
438438

439-
// Allows use of the :literal macro fragment specifier (RFC 1576)
440-
(active, macro_literal_matcher, "1.27.0", Some(35625), None),
441-
442439
// inconsistent bounds in where clauses
443440
(active, trivial_bounds, "1.28.0", Some(48214), None),
444441

@@ -690,6 +687,8 @@ declare_features! (
690687
(accepted, impl_header_lifetime_elision, "1.31.0", Some(15872), None),
691688
// `extern crate foo as bar;` puts `bar` into extern prelude.
692689
(accepted, extern_crate_item_prelude, "1.31.0", Some(55599), None),
690+
// Allows use of the :literal macro fragment specifier (RFC 1576)
691+
(accepted, macro_literal_matcher, "1.31.0", Some(35625), None),
693692
);
694693

695694
// If you change this, please modify src/doc/unstable-book as well. You must
@@ -1425,9 +1424,6 @@ pub const EXPLAIN_DEPR_CUSTOM_DERIVE: &'static str =
14251424
pub const EXPLAIN_DERIVE_UNDERSCORE: &'static str =
14261425
"attributes of the form `#[derive_*]` are reserved for the compiler";
14271426

1428-
pub const EXPLAIN_LITERAL_MATCHER: &'static str =
1429-
":literal fragment specifier is experimental and subject to change";
1430-
14311427
pub const EXPLAIN_UNSIZED_TUPLE_COERCION: &'static str =
14321428
"unsized tuple coercion is not stable enough for use and is subject to change";
14331429

src/test/run-pass/issues/issue-52169.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111
// run-pass
12-
#![feature(macro_literal_matcher)]
1312

1413
macro_rules! a {
1514
($i:literal) => { "right" };

src/test/run-pass/macros/macro-literal.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111
// run-pass
12-
#![feature(macro_literal_matcher)]
1312

1413
macro_rules! mtester {
1514
($l:literal) => {

src/test/ui/feature-gates/feature-gate-macro-literal-matcher.rs

-19
This file was deleted.

src/test/ui/feature-gates/feature-gate-macro-literal-matcher.stderr

-11
This file was deleted.

0 commit comments

Comments
 (0)