Skip to content

Commit cb1ce7d

Browse files
committed
Auto merge of #50385 - durka:stabilize-macro-lifetime, r=petrochenkov
stabilize macro_lifetime_matcher This stabilizes `:lifetime` which has completed FCP in #34303.
2 parents 7bfa20b + e857c1b commit cb1ce7d

13 files changed

+7
-75
lines changed

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

-14
This file was deleted.

src/librustc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
#![feature(from_ref)]
5151
#![feature(fs_read_write)]
5252
#![cfg_attr(windows, feature(libc))]
53-
#![feature(macro_lifetime_matcher)]
53+
#![cfg_attr(stage0, feature(macro_lifetime_matcher))]
5454
#![feature(macro_vis_matcher)]
5555
#![feature(never_type)]
5656
#![feature(exhaustive_patterns)]

src/librustc_metadata/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@
1515
#![feature(box_patterns)]
1616
#![feature(fs_read_write)]
1717
#![feature(libc)]
18-
#![feature(macro_lifetime_matcher)]
18+
#![cfg_attr(stage0, feature(macro_lifetime_matcher))]
1919
#![feature(proc_macro_internals)]
20-
#![feature(macro_lifetime_matcher)]
2120
#![feature(quote)]
2221
#![feature(rustc_diagnostic_macros)]
2322
#![feature(slice_sort_by_cached_key)]

src/librustc_save_analysis/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
1313
html_root_url = "https://doc.rust-lang.org/nightly/")]
1414
#![feature(custom_attribute)]
15-
#![feature(macro_lifetime_matcher)]
15+
#![cfg_attr(stage0, feature(macro_lifetime_matcher))]
1616
#![allow(unused_attributes)]
1717

1818
#[macro_use]

src/libsyntax/ext/tt/macro_rules.rs

+1-13
Original file line numberDiff line numberDiff line change
@@ -904,20 +904,8 @@ fn is_legal_fragment_specifier(sess: &ParseSess,
904904
frag_name: &str,
905905
frag_span: Span) -> bool {
906906
match frag_name {
907-
"item" | "block" | "stmt" | "expr" | "pat" |
907+
"item" | "block" | "stmt" | "expr" | "pat" | "lifetime" |
908908
"path" | "ty" | "ident" | "meta" | "tt" | "" => true,
909-
"lifetime" => {
910-
if !features.macro_lifetime_matcher &&
911-
!attr::contains_name(attrs, "allow_internal_unstable") {
912-
let explain = feature_gate::EXPLAIN_LIFETIME_MATCHER;
913-
emit_feature_err(sess,
914-
"macro_lifetime_matcher",
915-
frag_span,
916-
GateIssue::Language,
917-
explain);
918-
}
919-
true
920-
},
921909
"literal" => {
922910
if !features.macro_literal_matcher &&
923911
!attr::contains_name(attrs, "allow_internal_unstable") {

src/libsyntax/feature_gate.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,6 @@ declare_features! (
396396
// Termination trait in tests (RFC 1937)
397397
(active, termination_trait_test, "1.24.0", Some(48854), Some(Edition::Edition2018)),
398398

399-
// Allows use of the :lifetime macro fragment specifier
400-
(active, macro_lifetime_matcher, "1.24.0", Some(46895), None),
401-
402399
// `extern` in paths
403400
(active, extern_in_paths, "1.23.0", Some(44660), None),
404401

@@ -598,6 +595,8 @@ declare_features! (
598595
(accepted, dyn_trait, "1.27.0", Some(44662), None),
599596
// allow `#[must_use]` on functions; and, must-use operators (RFC 1940)
600597
(accepted, fn_must_use, "1.27.0", Some(43302), None),
598+
// Allows use of the :lifetime macro fragment specifier
599+
(accepted, macro_lifetime_matcher, "1.27.0", Some(34303), None),
601600
);
602601

603602
// If you change this, please modify src/doc/unstable-book as well. You must
@@ -1331,9 +1330,6 @@ pub const EXPLAIN_DERIVE_UNDERSCORE: &'static str =
13311330
pub const EXPLAIN_VIS_MATCHER: &'static str =
13321331
":vis fragment specifier is experimental and subject to change";
13331332

1334-
pub const EXPLAIN_LIFETIME_MATCHER: &'static str =
1335-
":lifetime fragment specifier is experimental and subject to change";
1336-
13371333
pub const EXPLAIN_LITERAL_MATCHER: &'static str =
13381334
":literal fragment specifier is experimental and subject to change";
13391335

src/test/run-pass/macro-lifetime-used-with-bound.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(macro_lifetime_matcher)]
12-
1311
macro_rules! foo {
1412
($l:lifetime, $l2:lifetime) => {
1513
fn f<$l: $l2, $l2>(arg: &$l str, arg2: &$l2 str) -> &$l str {

src/test/run-pass/macro-lifetime-used-with-labels.rs

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

1111
#![allow(unreachable_code)]
12-
#![feature(macro_lifetime_matcher)]
1312

1413
macro_rules! x {
1514
($a:lifetime) => {

src/test/run-pass/macro-lifetime-used-with-static.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(macro_lifetime_matcher)]
12-
1311
macro_rules! foo {
1412
($l:lifetime) => {
1513
fn f(arg: &$l str) -> &$l str {

src/test/run-pass/macro-lifetime.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(macro_lifetime_matcher)]
12-
1311
macro_rules! foo {
1412
($l:lifetime) => {
1513
fn f<$l>(arg: &$l str) -> &$l str {

src/test/ui/feature-gate-macro-lifetime-matcher.rs

-19
This file was deleted.

src/test/ui/feature-gate-macro-lifetime-matcher.stderr

-11
This file was deleted.

src/test/ui/macros/nonterminal-matching.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// Check that we are refusing to match on complex nonterminals for which tokens are
1212
// unavailable and we'd have to go through AST comparisons.
1313

14-
#![feature(decl_macro, macro_lifetime_matcher)]
14+
#![feature(decl_macro)]
1515

1616
macro simple_nonterminal($nt_ident: ident, $nt_lifetime: lifetime, $nt_tt: tt) {
1717
macro n(a $nt_ident b $nt_lifetime c $nt_tt d) {

0 commit comments

Comments
 (0)