diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2020-03-07 15:58:27 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2020-03-09 12:42:41 +0300 |
| commit | 9be233cbfe134f032ed2d50f7cc66e901bbe3f6f (patch) | |
| tree | 29073f8d2cf134e40c898d69696095c26c123814 /src/librustc_ast/attr/mod.rs | |
| parent | 5d7f67d3b109e95fb0dca8f773a2146db4eb4a93 (diff) | |
| download | rust-9be233cbfe134f032ed2d50f7cc66e901bbe3f6f.tar.gz rust-9be233cbfe134f032ed2d50f7cc66e901bbe3f6f.zip | |
Use `Token::uninterpolate` in couple more places matching on `(Nt)Ident`
Diffstat (limited to 'src/librustc_ast/attr/mod.rs')
| -rw-r--r-- | src/librustc_ast/attr/mod.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/librustc_ast/attr/mod.rs b/src/librustc_ast/attr/mod.rs index 280994116c0..52a59e82ae2 100644 --- a/src/librustc_ast/attr/mod.rs +++ b/src/librustc_ast/attr/mod.rs @@ -441,7 +441,7 @@ impl MetaItem { I: Iterator<Item = TokenTree>, { // FIXME: Share code with `parse_path`. - let path = match tokens.next() { + let path = match tokens.next().map(TokenTree::uninterpolate) { Some(TokenTree::Token(Token { kind: kind @ token::Ident(..), span })) | Some(TokenTree::Token(Token { kind: kind @ token::ModSep, span })) => 'arm: { let mut segments = if let token::Ident(name, _) = kind { @@ -457,7 +457,7 @@ impl MetaItem { }; loop { if let Some(TokenTree::Token(Token { kind: token::Ident(name, _), span })) = - tokens.next() + tokens.next().map(TokenTree::uninterpolate) { segments.push(PathSegment::from_ident(Ident::new(name, span))); } else { @@ -474,7 +474,6 @@ impl MetaItem { Path { span, segments } } Some(TokenTree::Token(Token { kind: token::Interpolated(nt), .. })) => match *nt { - token::Nonterminal::NtIdent(ident, _) => Path::from_ident(ident), token::Nonterminal::NtMeta(ref item) => return item.meta(item.path.span), token::Nonterminal::NtPath(ref path) => path.clone(), _ => return None, |
