diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-05-19 01:04:26 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-05-23 12:46:24 +0300 |
| commit | ca2a50fad7439f02a9e99f8107ffed8460fc8c44 (patch) | |
| tree | 4552fd5c786238aa51f716f983804f8c101dc1fd /src/libsyntax_ext/assert.rs | |
| parent | 558559e70f648ff518da5ada726da2f04b617197 (diff) | |
| download | rust-ca2a50fad7439f02a9e99f8107ffed8460fc8c44.tar.gz rust-ca2a50fad7439f02a9e99f8107ffed8460fc8c44.zip | |
syntax: Turn `token::Lit` into a struct
Diffstat (limited to 'src/libsyntax_ext/assert.rs')
| -rw-r--r-- | src/libsyntax_ext/assert.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/libsyntax_ext/assert.rs b/src/libsyntax_ext/assert.rs index cd69733571d..a11cd9c6f76 100644 --- a/src/libsyntax_ext/assert.rs +++ b/src/libsyntax_ext/assert.rs @@ -4,7 +4,7 @@ use syntax::ast::{self, *}; use syntax::source_map::Spanned; use syntax::ext::base::*; use syntax::ext::build::AstBuilder; -use syntax::parse::token; +use syntax::parse::token::{self, Token}; use syntax::parse::parser::Parser; use syntax::print::pprust; use syntax::ptr::P; @@ -31,13 +31,10 @@ pub fn expand_assert<'cx>( tts: custom_message.unwrap_or_else(|| { TokenStream::from(TokenTree::Token( DUMMY_SP, - token::Literal( - token::Lit::Str_(Name::intern(&format!( - "assertion failed: {}", - pprust::expr_to_string(&cond_expr).escape_debug() - ))), - None, - ), + Token::lit(token::Str, Symbol::intern(&format!( + "assertion failed: {}", + pprust::expr_to_string(&cond_expr).escape_debug() + )), None), )) }).into(), delim: MacDelimiter::Parenthesis, @@ -106,7 +103,7 @@ fn parse_assert<'a>( // // Parse this as an actual message, and suggest inserting a comma. Eventually, this should be // turned into an error. - let custom_message = if let token::Literal(token::Lit::Str_(_), _) = parser.token { + let custom_message = if let token::Literal(token::Lit { kind: token::Str, .. }) = parser.token { let mut err = cx.struct_span_warn(parser.span, "unexpected string literal"); let comma_span = cx.source_map().next_point(parser.prev_span); err.span_suggestion_short( |
