diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2018-10-15 10:15:15 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-10-15 10:15:15 -0700 |
| commit | 78765e52440e9a17218e2aa69f694a9c82aef7cf (patch) | |
| tree | d7ffc34eb02586eb6d7e056618acad4c2e3fec7d /src/libsyntax | |
| parent | defcb164b1f2a4cb20a0ee100a747b1232b54b88 (diff) | |
| parent | 09f42dd9029f0913355a9c52d6a0c6642f0e6e52 (diff) | |
| download | rust-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.rs | 11 |
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: "ed::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)) } } } |
