Update for rustc 1.0.0-nightly (8903c21d6 2015-01-15 22:42:58 +0000)

This commit is contained in:
Dan Burkert
2015-01-17 16:32:29 -08:00
parent 8715a41158
commit 460dbce8cc
19 changed files with 160 additions and 147 deletions
+2 -2
View File
@@ -2,13 +2,13 @@
name = "serde2"
version = "0.1.0"
dependencies = [
"rustc-serialize 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"serde2_macros 0.1.0",
]
[[package]]
name = "rustc-serialize"
version = "0.2.6"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
+6 -6
View File
@@ -157,7 +157,7 @@ impl rustc_serialize::Encodable for HttpProtocol {
impl rustc_serialize::Decodable for HttpProtocol {
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<HttpProtocol, D::Error> {
match FromPrimitive::from_uint(try!(d.read_uint())) {
match FromPrimitive::from_uint(try!(d.read_usize())) {
Some(value) => Ok(value),
None => Err(d.error("cannot convert from uint")),
}
@@ -209,7 +209,7 @@ impl rustc_serialize::Encodable for HttpMethod {
impl rustc_serialize::Decodable for HttpMethod {
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<HttpMethod, D::Error> {
match FromPrimitive::from_uint(try!(d.read_uint())) {
match FromPrimitive::from_uint(try!(d.read_usize())) {
Some(value) => Ok(value),
None => Err(d.error("cannot convert from uint")),
}
@@ -254,7 +254,7 @@ impl rustc_serialize::Encodable for CacheStatus {
impl rustc_serialize::Decodable for CacheStatus {
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<CacheStatus, D::Error> {
match FromPrimitive::from_uint(try!(d.read_uint())) {
match FromPrimitive::from_uint(try!(d.read_usize())) {
Some(value) => Ok(value),
None => Err(d.error("cannot convert from uint")),
}
@@ -386,7 +386,7 @@ impl rustc_serialize::Encodable for OriginProtocol {
impl rustc_serialize::Decodable for OriginProtocol {
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<OriginProtocol, D::Error> {
match FromPrimitive::from_uint(try!(d.read_uint())) {
match FromPrimitive::from_uint(try!(d.read_usize())) {
Some(value) => Ok(value),
None => Err(d.error("cannot convert from uint")),
}
@@ -429,7 +429,7 @@ impl rustc_serialize::Encodable for ZonePlan {
impl rustc_serialize::Decodable for ZonePlan {
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<ZonePlan, D::Error> {
match FromPrimitive::from_uint(try!(d.read_uint())) {
match FromPrimitive::from_uint(try!(d.read_usize())) {
Some(value) => Ok(value),
None => Err(d.error("cannot convert from uint")),
}
@@ -723,7 +723,7 @@ impl rustc_serialize::Encodable for Country {
impl rustc_serialize::Decodable for Country {
fn decode<D: rustc_serialize::Decoder>(d: &mut D) -> Result<Country, D::Error> {
match FromPrimitive::from_uint(try!(d.read_uint())) {
match FromPrimitive::from_uint(try!(d.read_usize())) {
Some(value) => Ok(value),
None => Err(d.error("cannot convert from uint")),
}
+18 -18
View File
@@ -49,12 +49,12 @@ use rustc::plugin::Registry;
pub fn plugin_registrar(reg: &mut Registry) {
reg.register_syntax_extension(
token::intern("derive_serialize"),
Decorator(box expand_derive_serialize));
Decorator(Box::new(expand_derive_serialize)));
/*
reg.register_syntax_extension(
token::intern("derive_deserialize"),
ItemDecorator(box expand_derive_deserialize));
ItemDecorator(Box::new(expand_derive_deserialize)));
*/
}
@@ -89,9 +89,9 @@ fn expand_derive_serialize<>(cx: &mut ExtCtxt,
vec!["serde2", "ser", "Visitor"],
None,
vec![
box Literal(Path::new_local("__S")),
box Literal(Path::new_local("__R")),
box Literal(Path::new_local("__E")),
Box::new(Literal(Path::new_local("__S"))),
Box::new(Literal(Path::new_local("__R"))),
Box::new(Literal(Path::new_local("__E"))),
],
true
),
@@ -102,7 +102,7 @@ fn expand_derive_serialize<>(cx: &mut ExtCtxt,
explicit_self: borrowed_explicit_self(),
args: vec![
Ptr(
box Literal(Path::new_local("__S")),
Box::new(Literal(Path::new_local("__S"))),
Borrowed(None, MutMutable)
),
Literal(
@@ -114,16 +114,16 @@ fn expand_derive_serialize<>(cx: &mut ExtCtxt,
vec!("std", "result", "Result"),
None,
vec![
box Literal(Path::new_local("__R")),
box Literal(Path::new_local("__E")),
Box::new(Literal(Path::new_local("__R"))),
Box::new(Literal(Path::new_local("__E"))),
],
true
)
),
attributes: attrs,
combine_substructure: combine_substructure(box |a, b, c| {
combine_substructure: combine_substructure(Box::new(|a, b, c| {
serialize_substructure(a, b, c)
}),
})),
}
]
};
@@ -270,14 +270,14 @@ pub fn expand_derive_deserialize(cx: &mut ExtCtxt,
span: span,
attributes: Vec::new(),
path: Path::new_(vec!("serde2", "de", "Deserialize"), None,
vec!(box Literal(Path::new_local("__D")),
box Literal(Path::new_local("__E"))), true),
vec!(Box::new(Literal(Path::new_local("__D"))),
Box::new(Literal(Path::new_local("__E")))), true),
additional_bounds: Vec::new(),
generics: LifetimeBounds {
lifetimes: Vec::new(),
bounds: vec!(("__D", None, vec!(Path::new_(
vec!("serde2", "de", "Deserializer"), None,
vec!(box Literal(Path::new_local("__E"))), true))),
vec!(Box::new(Literal(Path::new_local("__E")))), true))),
("__E", None, vec!()))
},
methods: vec!(
@@ -287,7 +287,7 @@ pub fn expand_derive_deserialize(cx: &mut ExtCtxt,
explicit_self: None,
args: vec!(
Ptr(
box Literal(Path::new_local("__D")),
Box::new(Literal(Path::new_local("__D"))),
Borrowed(None, MutMutable)
),
Literal(Path::new(vec!("serde2", "de", "Token"))),
@@ -297,16 +297,16 @@ pub fn expand_derive_deserialize(cx: &mut ExtCtxt,
vec!("std", "result", "Result"),
None,
vec!(
box Self,
box Literal(Path::new_local("__E"))
Box::new(Self),
Box::new(Literal(Path::new_local("__E")))
),
true
)
),
attributes: Vec::new(),
combine_substructure: combine_substructure(box |a, b, c| {
combine_substructure: combine_substructure(Box::new(|a, b, c| {
deserialize_substructure(a, b, c)
}),
})),
})
};
+25 -25
View File
@@ -357,7 +357,7 @@ pub fn main() {
let mut state = MyDeserializer::new(tokens.into_iter());
let v: Result<Vec<int>, Error> = Deserialize::deserialize(&mut state);
println!("vec: {}", v);
println!("vec: {:?}", v);
////
@@ -370,7 +370,7 @@ pub fn main() {
let mut state = MyDeserializer::new(tokens.into_iter());
let v: Result<(int, int), Error> = Deserialize::deserialize(&mut state);
println!("tuple: {}", v);
println!("tuple: {:?}", v);
////
@@ -383,7 +383,7 @@ pub fn main() {
let mut state = MyDeserializer::new(tokens.into_iter());
let v: Result<json::Value, Error> = Deserialize::deserialize(&mut state);
println!("value: {}", v);
println!("value: {:?}", v);
////
@@ -394,7 +394,7 @@ pub fn main() {
let mut state = MyDeserializer::new(tokens.into_iter());
let v: Result<option::Option<int>, Error> = Deserialize::deserialize(&mut state);
println!("optiony: {}", v);
println!("optiony: {:?}", v);
////
@@ -404,7 +404,7 @@ pub fn main() {
let mut state = MyDeserializer::new(tokens.into_iter());
let v: Result<option::Option<int>, Error> = Deserialize::deserialize(&mut state);
println!("optiony: {}", v);
println!("optiony: {:?}", v);
////
@@ -415,7 +415,7 @@ pub fn main() {
let mut state = MyDeserializer::new(tokens.into_iter());
let v: Result<json::Value, Error> = Deserialize::deserialize(&mut state);
println!("optiony value: {}", v);
println!("optiony value: {:?}", v);
////
@@ -425,7 +425,7 @@ pub fn main() {
let mut state = MyDeserializer::new(tokens.into_iter());
let v: Result<json::Value, Error> = Deserialize::deserialize(&mut state);
println!("optiony value: {}", v);
println!("optiony value: {:?}", v);
////
@@ -435,7 +435,7 @@ pub fn main() {
let mut state = MyDeserializer::new(tokens.into_iter());
let v: Result<option::Option<int>, Error> = Deserialize::deserialize(&mut state);
println!("option: {}", v);
println!("option: {:?}", v);
////
@@ -445,7 +445,7 @@ pub fn main() {
let mut state = MyDeserializer::new(tokens.into_iter());
let v: Result<option::Option<int>, Error> = Deserialize::deserialize(&mut state);
println!("option: {}", v);
println!("option: {:?}", v);
////
@@ -455,7 +455,7 @@ pub fn main() {
let mut state = MyDeserializer::new(tokens.into_iter());
let v: Result<json::Value, Error> = Deserialize::deserialize(&mut state);
println!("option value: {}", v);
println!("option value: {:?}", v);
////
@@ -465,7 +465,7 @@ pub fn main() {
let mut state = MyDeserializer::new(tokens.into_iter());
let v: Result<json::Value, Error> = Deserialize::deserialize(&mut state);
println!("option value: {}", v);
println!("option value: {:?}", v);
////
@@ -480,7 +480,7 @@ pub fn main() {
let mut state = MyDeserializer::new(tokens.into_iter());
let v: Result<HashMap<string::String, int>, Error> = Deserialize::deserialize(&mut state);
println!("{}", v);
println!("{:?}", v);
////
@@ -495,7 +495,7 @@ pub fn main() {
let mut state = MyDeserializer::new(tokens.into_iter());
let v: Result<json::Value, Error> = Deserialize::deserialize(&mut state);
println!("{}", v);
println!("{:?}", v);
}
@@ -560,9 +560,9 @@ fn main() {
let mut s = GatherTokens::new();
value.serialize(&mut s);
println!("tokens: {}", s.unwrap());
println!("tokens: {:?}", s.unwrap());
println!("json: {}", json::to_string(&value).unwrap().unwrap());
println!("json: {:?}", json::to_string(&value).unwrap().unwrap());
println!("");
////
@@ -571,9 +571,9 @@ fn main() {
let mut s = GatherTokens::new();
value.serialize(&mut s);
println!("tokens: {}", s.unwrap());
println!("tokens: {:?}", s.unwrap());
println!("json: {}", json::to_string(&value).unwrap().unwrap());
println!("json: {:?}", json::to_string(&value).unwrap().unwrap());
println!("");
////
@@ -585,25 +585,25 @@ fn main() {
let mut s = GatherTokens::new();
value.serialize(&mut s);
println!("tokens: {}", s.unwrap());
println!("tokens: {:?}", s.unwrap());
println!("json: {}", json::to_string(&value).unwrap().unwrap());
println!("json: {:?}", json::to_string(&value).unwrap().unwrap());
println!("");
////
/*
println!("{}", to_format_vec(&5i));
println!("{}", to_format_string(&5i));
println!("{:?}", to_format_vec(&5i));
println!("{:?}", to_format_string(&5i));
*/
let value = Foo { x: 1, y: 2, z: "abc" };
let mut s = GatherTokens::new();
value.serialize(&mut s);
println!("tokens: {}", s.unwrap());
println!("tokens: {:?}", s.unwrap());
println!("json: {}", json::to_string(&value).unwrap().unwrap());
println!("json: {:?}", json::to_string(&value).unwrap().unwrap());
println!("");
////
@@ -612,9 +612,9 @@ fn main() {
let mut s = GatherTokens::new();
value.serialize(&mut s);
println!("tokens: {}", s.unwrap());
println!("tokens: {:?}", s.unwrap());
println!("json: {}", json::to_string(&value).unwrap().unwrap());
println!("json: {:?}", json::to_string(&value).unwrap().unwrap());
println!("");
}
*/
+3 -2
View File
@@ -1,4 +1,5 @@
use std::collections::{HashMap, BTreeMap};
use std::collections::hash_map::Hasher;
use std::hash::Hash;
use std::num::FromPrimitive;
@@ -429,7 +430,7 @@ impl_deserialize_tuple! { T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, }
///////////////////////////////////////////////////////////////////////////////
impl<
K: Deserialize<S, E> + Eq + Hash,
K: Deserialize<S, E> + Eq + Hash<Hasher>,
V: Deserialize<S, E>,
S: Deserializer<E>,
E: Error,
@@ -438,7 +439,7 @@ impl<
struct Visitor;
impl<
K: Deserialize<S, E> + Eq + Hash,
K: Deserialize<S, E> + Eq + Hash<Hasher>,
V: Deserialize<S, E>,
S: Deserializer<E>,
E: Error,
+1 -1
View File
@@ -103,7 +103,7 @@ impl error::Error for Error {
fn detail(&self) -> Option<String> {
match *self {
Error::SyntaxError(ref code, line, col) => {
Some(format!("{} at line {} column {}", code, line, col))
Some(format!("{:?} at line {:?} column {:?}", code, line, col))
}
Error::IoError(ref error) => error.detail(),
/*
+4 -4
View File
@@ -473,8 +473,8 @@ impl<
> MapVisitor<S, R, E> for MapIteratorVisitor<Iter> {
#[inline]
fn visit<
V: Visitor<S, R, E>,
>(&mut self, state: &mut S, visitor: V) -> Result<Option<R>, E> {
VS: Visitor<S, R, E>,
>(&mut self, state: &mut S, visitor: VS) -> Result<Option<R>, E> {
let first = self.first;
self.first = false;
@@ -504,8 +504,8 @@ impl<
S,
R,
E,
V: Visitor<S, R, E>,
>(&self, state: &mut S, visitor: V) -> Result<R, E> {
VS: Visitor<S, R, E>,
>(&self, state: &mut S, visitor: VS) -> Result<R, E> {
visitor.visit_map(state, MapIteratorVisitor::new(self.iter()))
}
}