1
Fork 0

libsyntax => 2018

This commit is contained in:
Taiki Endo 2019-02-07 02:33:01 +09:00
parent 2596bc1368
commit 7bb082d27f
46 changed files with 612 additions and 569 deletions

View file

@ -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())