diff options
| author | bors <bors@rust-lang.org> | 2017-03-01 05:58:09 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-03-01 05:58:09 +0000 |
| commit | 7ce1fbe1f7fe5cdbec57377d76306e2bc7811bce (patch) | |
| tree | 0fb917efd8b1fe14e7fbf49c4c01c8f0f7504af4 /src/libsyntax/parse/token.rs | |
| parent | 2f52386f1072755d1b9973014e8e1d4b383e8eef (diff) | |
| parent | 839398a0b4a5b77fe3dd351107b1cbe45e1004de (diff) | |
| download | rust-7ce1fbe1f7fe5cdbec57377d76306e2bc7811bce.tar.gz rust-7ce1fbe1f7fe5cdbec57377d76306e2bc7811bce.zip | |
Auto merge of #39419 - jseyfried:simplify_tokentree, r=nrc
Simplify `TokenTree` and fix `macro_rules!` bugs This PR - fixes #39390, fixes #39403, and fixes #39404 (each is a [breaking-change], see issues for examples), - fixes #39889, - simplifies and optimizes macro invocation parsing, - cleans up `ext::tt::transcribe`, - removes `tokenstream::TokenTree::Sequence` and `Token::MatchNt`, - instead, adds a new type `ext::tt::quoted::TokenTree` for use by `macro_rules!` (`ext::tt`) - removes `parser.quote_depth` and `parser.parsing_token_tree`, and - removes `quote_matcher!`. - Instead, use `quote_tokens!` and `ext::tt::quoted::parse` the result with `expect_matchers=true`. - I found no outside uses of `quote_matcher!` when searching Rust code on Github. r? @nrc
Diffstat (limited to 'src/libsyntax/parse/token.rs')
| -rw-r--r-- | src/libsyntax/parse/token.rs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 0f0c6d0ca83..5b65aac92b8 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -50,8 +50,8 @@ pub enum DelimToken { } impl DelimToken { - pub fn len(&self) -> u32 { - if *self == NoDelim { 0 } else { 1 } + pub fn len(self) -> usize { + if self == NoDelim { 0 } else { 1 } } } @@ -152,9 +152,6 @@ pub enum Token { // Can be expanded into several tokens. /// Doc comment DocComment(ast::Name), - // In left-hand-sides of MBE macros: - /// Parse a nonterminal (name to bind, name of NT) - MatchNt(ast::Ident, ast::Ident), // In right-hand-sides of MBE macros: /// A syntactic variable that will be filled in by macro expansion. SubstNt(ast::Ident), |
