diff options
| author | Stefan Lankes <slankes@eonerc.rwth-aachen.de> | 2019-10-25 09:09:55 +0200 |
|---|---|---|
| committer | Stefan Lankes <slankes@eonerc.rwth-aachen.de> | 2019-10-25 09:09:55 +0200 |
| commit | d349e32fc70da197918256c29a0858fe7e1a6588 (patch) | |
| tree | 17f268176d32a172c84e84c30303a4794f4513b0 /src/libsyntax/tokenstream.rs | |
| parent | ddcd157d03a067419d7f5b4375cfaff5a474856a (diff) | |
| parent | d54111afc061ef398cd8ce28984f9e8d70001b24 (diff) | |
| download | rust-d349e32fc70da197918256c29a0858fe7e1a6588.tar.gz rust-d349e32fc70da197918256c29a0858fe7e1a6588.zip | |
Merge branch 'master' into rusty-hermit, resolve conflicts
Diffstat (limited to 'src/libsyntax/tokenstream.rs')
| -rw-r--r-- | src/libsyntax/tokenstream.rs | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/src/libsyntax/tokenstream.rs b/src/libsyntax/tokenstream.rs index ac155556cda..0559f224f1f 100644 --- a/src/libsyntax/tokenstream.rs +++ b/src/libsyntax/tokenstream.rs @@ -19,7 +19,6 @@ use syntax_pos::{BytePos, Span, DUMMY_SP}; #[cfg(target_arch = "x86_64")] use rustc_data_structures::static_assert_size; use rustc_data_structures::sync::Lrc; -use rustc_serialize::{Decoder, Decodable, Encoder, Encodable}; use smallvec::{SmallVec, smallvec}; use std::{iter, mem}; @@ -136,7 +135,7 @@ impl TokenTree { /// The goal is for procedural macros to work with `TokenStream`s and `TokenTree`s /// instead of a representation of the abstract syntax tree. /// Today's `TokenTree`s can still contain AST via `token::Interpolated` for back-compat. -#[derive(Clone, Debug, Default)] +#[derive(Clone, Debug, Default, RustcEncodable, RustcDecodable)] pub struct TokenStream(pub Lrc<Vec<TreeAndJoint>>); pub type TreeAndJoint = (TokenTree, IsJoint); @@ -145,7 +144,7 @@ pub type TreeAndJoint = (TokenTree, IsJoint); #[cfg(target_arch = "x86_64")] static_assert_size!(TokenStream, 8); -#[derive(Clone, Copy, Debug, PartialEq)] +#[derive(Clone, Copy, Debug, PartialEq, RustcEncodable, RustcDecodable)] pub enum IsJoint { Joint, NonJoint @@ -460,18 +459,6 @@ impl Cursor { } } -impl Encodable for TokenStream { - fn encode<E: Encoder>(&self, encoder: &mut E) -> Result<(), E::Error> { - self.trees().collect::<Vec<_>>().encode(encoder) - } -} - -impl Decodable for TokenStream { - fn decode<D: Decoder>(decoder: &mut D) -> Result<TokenStream, D::Error> { - Vec::<TokenTree>::decode(decoder).map(|vec| vec.into_iter().collect()) - } -} - #[derive(Debug, Copy, Clone, PartialEq, RustcEncodable, RustcDecodable)] pub struct DelimSpan { pub open: Span, |
