+++ /dev/null
-# `macro_lifetime_matcher`
-
-The tracking issue for this feature is: [#46895]
-
-With this feature gate enabled, the [list of fragment specifiers][frags] gains one more entry:
-
-* `lifetime`: a lifetime. Examples: 'static, 'a.
-
-A `lifetime` variable may be followed by anything.
-
-[#46895]: https://github.com/rust-lang/rust/issues/46895
-[frags]: ../book/first-edition/macros.html#syntactic-requirements
-
-------------------------
#![feature(from_ref)]
#![feature(fs_read_write)]
#![cfg_attr(windows, feature(libc))]
-#![feature(macro_lifetime_matcher)]
#![feature(macro_vis_matcher)]
#![feature(never_type)]
#![feature(exhaustive_patterns)]
#![feature(box_patterns)]
#![feature(fs_read_write)]
#![feature(libc)]
-#![feature(macro_lifetime_matcher)]
#![feature(proc_macro_internals)]
-#![feature(macro_lifetime_matcher)]
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
#![feature(slice_sort_by_cached_key)]
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![feature(custom_attribute)]
-#![feature(macro_lifetime_matcher)]
#![allow(unused_attributes)]
#[macro_use]
frag_name: &str,
frag_span: Span) -> bool {
match frag_name {
- "item" | "block" | "stmt" | "expr" | "pat" |
+ "item" | "block" | "stmt" | "expr" | "pat" | "lifetime" |
"path" | "ty" | "ident" | "meta" | "tt" | "" => true,
- "lifetime" => {
- if !features.macro_lifetime_matcher &&
- !attr::contains_name(attrs, "allow_internal_unstable") {
- let explain = feature_gate::EXPLAIN_LIFETIME_MATCHER;
- emit_feature_err(sess,
- "macro_lifetime_matcher",
- frag_span,
- GateIssue::Language,
- explain);
- }
- true
- },
"literal" => {
if !features.macro_literal_matcher &&
!attr::contains_name(attrs, "allow_internal_unstable") {
// Termination trait in tests (RFC 1937)
(active, termination_trait_test, "1.24.0", Some(48854), Some(Edition::Edition2018)),
- // Allows use of the :lifetime macro fragment specifier
- (active, macro_lifetime_matcher, "1.24.0", Some(46895), None),
-
// `extern` in paths
(active, extern_in_paths, "1.23.0", Some(44660), None),
(accepted, dyn_trait, "1.27.0", Some(44662), None),
// allow `#[must_use]` on functions; and, must-use operators (RFC 1940)
(accepted, fn_must_use, "1.27.0", Some(43302), None),
+ // Allows use of the :lifetime macro fragment specifier
+ (accepted, macro_lifetime_matcher, "1.27.0", Some(34303), None),
);
// If you change this, please modify src/doc/unstable-book as well. You must
pub const EXPLAIN_VIS_MATCHER: &'static str =
":vis fragment specifier is experimental and subject to change";
-pub const EXPLAIN_LIFETIME_MATCHER: &'static str =
- ":lifetime fragment specifier is experimental and subject to change";
-
pub const EXPLAIN_LITERAL_MATCHER: &'static str =
":literal fragment specifier is experimental and subject to change";
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(macro_lifetime_matcher)]
-
macro_rules! foo {
($l:lifetime, $l2:lifetime) => {
fn f<$l: $l2, $l2>(arg: &$l str, arg2: &$l2 str) -> &$l str {
// except according to those terms.
#![allow(unreachable_code)]
-#![feature(macro_lifetime_matcher)]
macro_rules! x {
($a:lifetime) => {
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(macro_lifetime_matcher)]
-
macro_rules! foo {
($l:lifetime) => {
fn f(arg: &$l str) -> &$l str {
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(macro_lifetime_matcher)]
-
macro_rules! foo {
($l:lifetime) => {
fn f<$l>(arg: &$l str) -> &$l str {
+++ /dev/null
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that the :lifetime macro fragment cannot be used when macro_lifetime_matcher
-// feature gate is not used.
-
-macro_rules! m { ($lt:lifetime) => {} }
-//~^ ERROR :lifetime fragment specifier is experimental and subject to change
-
-fn main() {
- m!('a);
-}
// Check that we are refusing to match on complex nonterminals for which tokens are
// unavailable and we'd have to go through AST comparisons.
-#![feature(decl_macro, macro_lifetime_matcher)]
+#![feature(decl_macro)]
macro simple_nonterminal($nt_ident: ident, $nt_lifetime: lifetime, $nt_tt: tt) {
macro n(a $nt_ident b $nt_lifetime c $nt_tt d) {