diff options
Diffstat (limited to 'src/libsyntax/tokenstream.rs')
| -rw-r--r-- | src/libsyntax/tokenstream.rs | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/libsyntax/tokenstream.rs b/src/libsyntax/tokenstream.rs index 2b950b46232..b6e4d4cd976 100644 --- a/src/libsyntax/tokenstream.rs +++ b/src/libsyntax/tokenstream.rs @@ -12,12 +12,15 @@ //! and a borrowed `TokenStream` is sufficient to build an owned `TokenStream` without taking //! ownership of the original. +use crate::ext::base; +use crate::ext::tt::{macro_parser, quoted}; +use crate::parse::Directory; +use crate::parse::token::{self, DelimToken, Token}; +use crate::print::pprust; + use syntax_pos::{BytePos, Mark, Span, DUMMY_SP}; -use ext::base; -use ext::tt::{macro_parser, quoted}; -use parse::Directory; -use parse::token::{self, DelimToken, Token}; -use print::pprust; +#[cfg(target_arch = "x86_64")] +use rustc_data_structures::static_assert; use rustc_data_structures::sync::Lrc; use serialize::{Decoder, Decodable, Encoder, Encodable}; @@ -46,7 +49,7 @@ pub enum TokenTree { impl TokenTree { /// Use this token tree as a matcher to parse given tts. - pub fn parse(cx: &base::ExtCtxt, mtch: &[quoted::TokenTree], tts: TokenStream) + pub fn parse(cx: &base::ExtCtxt<'_>, mtch: &[quoted::TokenTree], tts: TokenStream) -> macro_parser::NamedParseResult { // `None` is because we're not interpolating let directory = Directory { @@ -161,7 +164,7 @@ pub enum IsJoint { NonJoint } -use self::IsJoint::*; +use IsJoint::*; impl TokenStream { /// Given a `TokenStream` with a `Stream` of only two arguments, return a new `TokenStream` @@ -492,7 +495,7 @@ impl Cursor { } impl fmt::Display for TokenStream { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(&pprust::tokens_to_string(self.clone())) } } @@ -546,11 +549,11 @@ impl DelimSpan { #[cfg(test)] mod tests { use super::*; - use syntax::ast::Ident; - use with_globals; + use crate::syntax::ast::Ident; + use crate::with_globals; + use crate::parse::token::Token; + use crate::util::parser_testing::string_to_stream; use syntax_pos::{Span, BytePos, NO_EXPANSION}; - use parse::token::Token; - use util::parser_testing::string_to_stream; fn string_to_ts(string: &str) -> TokenStream { string_to_stream(string.to_owned()) |
