rustc_metadata: go only through rustc_serialize in astencode.

This commit is contained in:
Eduard Burtescu 2016-08-31 14:00:29 +03:00
parent 91e7239db4
commit fc363cb482
70 changed files with 605 additions and 1212 deletions

View file

@ -28,6 +28,7 @@
#![feature(rustc_private)]
#![feature(staged_api)]
#![feature(question_mark)]
#![feature(specialization)]
use std::cell::{Cell, RefCell};
use std::ops::{Add, Sub};
@ -151,21 +152,7 @@ impl Encodable for Span {
}
}
impl Decodable for Span {
fn decode<D: Decoder>(d: &mut D) -> Result<Span, D::Error> {
d.read_struct("Span", 2, |d| {
let lo = d.read_struct_field("lo", 0, |d| {
BytePos::decode(d)
})?;
let hi = d.read_struct_field("hi", 1, |d| {
BytePos::decode(d)
})?;
Ok(mk_sp(lo, hi))
})
}
}
impl serialize::UseSpecializedDecodable for Span {}
fn default_span_debug(span: Span, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Span {{ lo: {:?}, hi: {:?}, expn_id: {:?} }}",