diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-05-18 17:36:30 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-05-23 12:44:05 +0300 |
| commit | fcc2f92f454d9ce1e66713e28edb136d6948dd5a (patch) | |
| tree | 1a5893ca61d737492851dfba7d3831949333071e /src/libsyntax/attr | |
| parent | 85334c50921a1c90707c9d0fb344c63bd373e1b8 (diff) | |
| download | rust-fcc2f92f454d9ce1e66713e28edb136d6948dd5a.tar.gz rust-fcc2f92f454d9ce1e66713e28edb136d6948dd5a.zip | |
syntax: Return named errors from literal parsing functions
Diffstat (limited to 'src/libsyntax/attr')
| -rw-r--r-- | src/libsyntax/attr/mod.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsyntax/attr/mod.rs b/src/libsyntax/attr/mod.rs index a97c094418d..2f75a8c9db5 100644 --- a/src/libsyntax/attr/mod.rs +++ b/src/libsyntax/attr/mod.rs @@ -554,7 +554,7 @@ impl MetaItemKind { Some(TokenTree::Token(_, token::Eq)) => { tokens.next(); return if let Some(TokenTree::Token(span, token)) = tokens.next() { - Lit::from_token(&token, span, None).map(MetaItemKind::NameValue) + Lit::from_token(&token, span).ok().map(MetaItemKind::NameValue) } else { None }; @@ -599,7 +599,7 @@ impl NestedMetaItem { where I: Iterator<Item = TokenTree>, { if let Some(TokenTree::Token(span, token)) = tokens.peek().cloned() { - if let Some(lit) = Lit::from_token(&token, span, None) { + if let Ok(lit) = Lit::from_token(&token, span) { tokens.next(); return Some(NestedMetaItem::Literal(lit)); } |
