summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2018-10-15 10:15:15 -0700
committerGitHub <noreply@github.com>2018-10-15 10:15:15 -0700
commit78765e52440e9a17218e2aa69f694a9c82aef7cf (patch)
treed7ffc34eb02586eb6d7e056618acad4c2e3fec7d /src/libsyntax
parentdefcb164b1f2a4cb20a0ee100a747b1232b54b88 (diff)
parent09f42dd9029f0913355a9c52d6a0c6642f0e6e52 (diff)
downloadrust-78765e52440e9a17218e2aa69f694a9c82aef7cf.tar.gz
rust-78765e52440e9a17218e2aa69f694a9c82aef7cf.zip
Rollup merge of #55025 - ehuss:missing-lifetime-err-msg, r=petrochenkov
Add missing lifetime fragment specifier to error message.

A very minor issue, `lifetime` was missing from the error list.
I left `literal` in the list, even though it is unstable. It looks like it may stabilize soon anyways.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ext/tt/macro_rules.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index 214bc9cffc4..87ade278c68 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -34,6 +34,10 @@ use std::collections::hash_map::Entry;
 use rustc_data_structures::sync::Lrc;
 use errors::Applicability;
 
+const VALID_FRAGMENT_NAMES_MSG: &str = "valid fragment specifiers are \
+    `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, \
+    `path`, `meta`, `tt`, `item` and `vis`";
+
 pub struct ParserAnyMacro<'a> {
     parser: Parser<'a>,
 
@@ -708,8 +712,7 @@ fn check_matcher_core(sess: &ParseSess,
                 if let Err(bad_frag) = has_legal_fragment_specifier(sess, features, attrs, token) {
                     let msg = format!("invalid fragment specifier `{}`", bad_frag);
                     sess.span_diagnostic.struct_span_err(token.span(), &msg)
-                        .help("valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, \
-                              `pat`, `ty`, `literal`, `path`, `meta`, `tt`, `item` and `vis`")
+                        .help(VALID_FRAGMENT_NAMES_MSG)
                         .emit();
                     // (This eliminates false positives and duplicates
                     // from error messages.)
@@ -938,9 +941,7 @@ fn is_in_follow(tok: &quoted::TokenTree, frag: &str) -> Result<bool, (String, &'
             },
             "" => Ok(true), // keywords::Invalid
             _ => Err((format!("invalid fragment specifier `{}`", frag),
-                     "valid fragment specifiers are `ident`, `block`, \
-                      `stmt`, `expr`, `pat`, `ty`, `path`, `meta`, `tt`, \
-                      `literal`, `item` and `vis`"))
+                     VALID_FRAGMENT_NAMES_MSG))
         }
     }
 }