Merge pull request #12 from renato-zannon/update-to-nightly

Update to nightly
This commit is contained in:
Erick Tryzelaar 2014-11-07 17:07:26 -08:00
commit 45247c7ef6
7 changed files with 31 additions and 26 deletions

View File

@ -150,12 +150,13 @@ mod decoder {
_f: |&mut AnimalDecoder| -> Result<T, Error>) _f: |&mut AnimalDecoder| -> Result<T, Error>)
-> Result<T, Error> { Err(SyntaxError) } -> Result<T, Error> { Err(SyntaxError) }
fn read_tuple<T>(&mut self, _f: |&mut AnimalDecoder, uint| -> Result<T, Error>) -> Result<T, Error> { Err(SyntaxError) } fn read_tuple<T>(&mut self, _len: uint, _f: |&mut AnimalDecoder| -> Result<T, Error>) -> Result<T, Error> { Err(SyntaxError) }
fn read_tuple_arg<T>(&mut self, _a_idx: uint, _f: |&mut AnimalDecoder| -> Result<T, Error>) -> Result<T, Error> { Err(SyntaxError) } fn read_tuple_arg<T>(&mut self, _a_idx: uint, _f: |&mut AnimalDecoder| -> Result<T, Error>) -> Result<T, Error> { Err(SyntaxError) }
fn read_tuple_struct<T>(&mut self, fn read_tuple_struct<T>(&mut self,
_s_name: &str, _s_name: &str,
_f: |&mut AnimalDecoder, uint| -> Result<T, Error>) _len: uint,
_f: |&mut AnimalDecoder| -> Result<T, Error>)
-> Result<T, Error> { Err(SyntaxError) } -> Result<T, Error> { Err(SyntaxError) }
fn read_tuple_struct_arg<T>(&mut self, fn read_tuple_struct_arg<T>(&mut self,
_a_idx: uint, _a_idx: uint,

View File

@ -569,10 +569,10 @@ fn push_all_bytes(dst: &mut Vec<u8>, src: &[u8]) {
let dst_len = dst.len(); let dst_len = dst.len();
let src_len = src.len(); let src_len = src.len();
dst.reserve_additional(src_len); dst.reserve(src_len);
unsafe { unsafe {
// we would have failed if `reserve_additional` overflowed. // we would have failed if `reserve` overflowed.
dst.set_len(dst_len + src_len); dst.set_len(dst_len + src_len);
::std::ptr::copy_nonoverlapping_memory( ::std::ptr::copy_nonoverlapping_memory(

View File

@ -28,7 +28,7 @@ pub enum Error {
mod decoder { mod decoder {
use std::collections::HashMap; use std::collections::HashMap;
use std::collections::hashmap::MoveEntries; use std::collections::hash_map::MoveEntries;
use serialize; use serialize;
use super::{Error, EndOfStream, SyntaxError, OtherError}; use super::{Error, EndOfStream, SyntaxError, OtherError};
@ -122,12 +122,13 @@ mod decoder {
_f: |&mut IntDecoder| -> Result<T, Error>) _f: |&mut IntDecoder| -> Result<T, Error>)
-> Result<T, Error> { Err(SyntaxError) } -> Result<T, Error> { Err(SyntaxError) }
fn read_tuple<T>(&mut self, _f: |&mut IntDecoder, uint| -> Result<T, Error>) -> Result<T, Error> { Err(SyntaxError) } fn read_tuple<T>(&mut self, _len: uint, _f: |&mut IntDecoder| -> Result<T, Error>) -> Result<T, Error> { Err(SyntaxError) }
fn read_tuple_arg<T>(&mut self, _a_idx: uint, _f: |&mut IntDecoder| -> Result<T, Error>) -> Result<T, Error> { Err(SyntaxError) } fn read_tuple_arg<T>(&mut self, _a_idx: uint, _f: |&mut IntDecoder| -> Result<T, Error>) -> Result<T, Error> { Err(SyntaxError) }
fn read_tuple_struct<T>(&mut self, fn read_tuple_struct<T>(&mut self,
_s_name: &str, _s_name: &str,
_f: |&mut IntDecoder, uint| -> Result<T, Error>) _len: uint,
_f: |&mut IntDecoder| -> Result<T, Error>)
-> Result<T, Error> { Err(SyntaxError) } -> Result<T, Error> { Err(SyntaxError) }
fn read_tuple_struct_arg<T>(&mut self, fn read_tuple_struct_arg<T>(&mut self,
_a_idx: uint, _a_idx: uint,
@ -169,7 +170,7 @@ mod decoder {
mod deserializer { mod deserializer {
use std::collections::HashMap; use std::collections::HashMap;
use std::collections::hashmap::MoveEntries; use std::collections::hash_map::MoveEntries;
use super::{Error, EndOfStream, SyntaxError}; use super::{Error, EndOfStream, SyntaxError};

View File

@ -191,12 +191,13 @@ mod decoder {
} }
} }
fn read_tuple<T>(&mut self, _f: |&mut OuterDecoder, uint| -> Result<T, Error>) -> Result<T, Error> { Err(SyntaxError("".to_string())) } fn read_tuple<T>(&mut self, _len: uint, _f: |&mut OuterDecoder| -> Result<T, Error>) -> Result<T, Error> { Err(SyntaxError("".to_string())) }
fn read_tuple_arg<T>(&mut self, _a_idx: uint, _f: |&mut OuterDecoder| -> Result<T, Error>) -> Result<T, Error> { Err(SyntaxError("".to_string())) } fn read_tuple_arg<T>(&mut self, _a_idx: uint, _f: |&mut OuterDecoder| -> Result<T, Error>) -> Result<T, Error> { Err(SyntaxError("".to_string())) }
fn read_tuple_struct<T>(&mut self, fn read_tuple_struct<T>(&mut self,
_s_name: &str, _s_name: &str,
_f: |&mut OuterDecoder, uint| -> Result<T, Error>) _len: uint,
_f: |&mut OuterDecoder| -> Result<T, Error>)
-> Result<T, Error> { Err(SyntaxError("".to_string())) } -> Result<T, Error> { Err(SyntaxError("".to_string())) }
fn read_tuple_struct_arg<T>(&mut self, fn read_tuple_struct_arg<T>(&mut self,
_a_idx: uint, _a_idx: uint,

View File

@ -105,12 +105,13 @@ mod decoder {
_f: |&mut IntDecoder| -> Result<T, Error>) _f: |&mut IntDecoder| -> Result<T, Error>)
-> Result<T, Error> { Err(SyntaxError) } -> Result<T, Error> { Err(SyntaxError) }
fn read_tuple<T>(&mut self, _f: |&mut IntDecoder, uint| -> Result<T, Error>) -> Result<T, Error> { Err(SyntaxError) } fn read_tuple<T>(&mut self, _len: uint, _f: |&mut IntDecoder| -> Result<T, Error>) -> Result<T, Error> { Err(SyntaxError) }
fn read_tuple_arg<T>(&mut self, _a_idx: uint, _f: |&mut IntDecoder| -> Result<T, Error>) -> Result<T, Error> { Err(SyntaxError) } fn read_tuple_arg<T>(&mut self, _a_idx: uint, _f: |&mut IntDecoder| -> Result<T, Error>) -> Result<T, Error> { Err(SyntaxError) }
fn read_tuple_struct<T>(&mut self, fn read_tuple_struct<T>(&mut self,
_s_name: &str, _s_name: &str,
_f: |&mut IntDecoder, uint| -> Result<T, Error>) _len: uint,
_f: |&mut IntDecoder| -> Result<T, Error>)
-> Result<T, Error> { Err(SyntaxError) } -> Result<T, Error> { Err(SyntaxError) }
fn read_tuple_struct_arg<T>(&mut self, fn read_tuple_struct_arg<T>(&mut self,
_a_idx: uint, _a_idx: uint,
@ -211,12 +212,13 @@ mod decoder {
_f: |&mut U8Decoder| -> Result<T, Error>) _f: |&mut U8Decoder| -> Result<T, Error>)
-> Result<T, Error> { Err(SyntaxError) } -> Result<T, Error> { Err(SyntaxError) }
fn read_tuple<T>(&mut self, _f: |&mut U8Decoder, uint| -> Result<T, Error>) -> Result<T, Error> { Err(SyntaxError) } fn read_tuple<T>(&mut self, _len: uint, _f: |&mut U8Decoder| -> Result<T, Error>) -> Result<T, Error> { Err(SyntaxError) }
fn read_tuple_arg<T>(&mut self, _a_idx: uint, _f: |&mut U8Decoder| -> Result<T, Error>) -> Result<T, Error> { Err(SyntaxError) } fn read_tuple_arg<T>(&mut self, _a_idx: uint, _f: |&mut U8Decoder| -> Result<T, Error>) -> Result<T, Error> { Err(SyntaxError) }
fn read_tuple_struct<T>(&mut self, fn read_tuple_struct<T>(&mut self,
_s_name: &str, _s_name: &str,
_f: |&mut U8Decoder, uint| -> Result<T, Error>) _len: uint,
_f: |&mut U8Decoder| -> Result<T, Error>)
-> Result<T, Error> { Err(SyntaxError) } -> Result<T, Error> { Err(SyntaxError) }
fn read_tuple_struct_arg<T>(&mut self, fn read_tuple_struct_arg<T>(&mut self,
_a_idx: uint, _a_idx: uint,

View File

@ -364,10 +364,10 @@ pub trait Deserializer<E>: Iterator<Result<Token, E>> {
Ok(None) Ok(None)
} }
Str(n) => { Str(n) => {
Ok(Some(fields.iter().position(|field| **field == n))) Ok(Some(fields.iter().position(|field| *field == n)))
} }
String(n) => { String(n) => {
Ok(Some(fields.iter().position(|field| **field == n.as_slice()))) Ok(Some(fields.iter().position(|field| *field == n.as_slice())))
} }
token => { token => {
Err(self.syntax_error(token, STR_TOKEN_KINDS)) Err(self.syntax_error(token, STR_TOKEN_KINDS))
@ -882,27 +882,27 @@ impl GatherTokens {
self.gather(d) self.gather(d)
} }
EnumStart(name, variant, len) => { EnumStart(name, variant, len) => {
self.tokens.reserve_additional(len + 1); self.tokens.reserve(len + 1);
self.tokens.push(EnumStart(name, variant, len)); self.tokens.push(EnumStart(name, variant, len));
self.gather_seq(d) self.gather_seq(d)
} }
StructStart(name, len) => { StructStart(name, len) => {
self.tokens.reserve_additional(len + 1); self.tokens.reserve(len + 1);
self.tokens.push(StructStart(name, len)); self.tokens.push(StructStart(name, len));
self.gather_struct(d) self.gather_struct(d)
} }
TupleStart(len) => { TupleStart(len) => {
self.tokens.reserve_additional(len + 1); self.tokens.reserve(len + 1);
self.tokens.push(TupleStart(len)); self.tokens.push(TupleStart(len));
self.gather_seq(d) self.gather_seq(d)
} }
SeqStart(len) => { SeqStart(len) => {
self.tokens.reserve_additional(len + 1); self.tokens.reserve(len + 1);
self.tokens.push(SeqStart(len)); self.tokens.push(SeqStart(len));
self.gather_seq(d) self.gather_seq(d)
} }
MapStart(len) => { MapStart(len) => {
self.tokens.reserve_additional(len + 1); self.tokens.reserve(len + 1);
self.tokens.push(MapStart(len)); self.tokens.push(MapStart(len));
self.gather_map(d) self.gather_map(d)
} }

View File

@ -264,7 +264,7 @@ fn main() {
*/ */
use std::char; use std::char;
use std::collections::{HashMap, TreeMap, treemap}; use std::collections::{HashMap, TreeMap, tree_map};
use std::f32; use std::f32;
use std::f64; use std::f64;
use std::fmt; use std::fmt;
@ -324,7 +324,7 @@ impl Json {
/// Otherwise, returns None. /// Otherwise, returns None.
pub fn find<'a>(&'a self, key: &string::String) -> Option<&'a Json>{ pub fn find<'a>(&'a self, key: &string::String) -> Option<&'a Json>{
match self { match self {
&Object(ref map) => map.find(key), &Object(ref map) => map.get(key),
_ => None _ => None
} }
} }
@ -349,7 +349,7 @@ impl Json {
pub fn search<'a>(&'a self, key: &string::String) -> Option<&'a Json> { pub fn search<'a>(&'a self, key: &string::String) -> Option<&'a Json> {
match self { match self {
&Object(ref map) => { &Object(ref map) => {
match map.find(key) { match map.get(key) {
Some(json_value) => Some(json_value), Some(json_value) => Some(json_value),
None => { None => {
let mut value : Option<&'a Json> = None; let mut value : Option<&'a Json> = None;
@ -573,7 +573,7 @@ impl<D: de::Deserializer<E>, E> de::Deserializable<D, E> for Json {
enum JsonDeserializerState { enum JsonDeserializerState {
JsonDeserializerValueState(Json), JsonDeserializerValueState(Json),
JsonDeserializerListState(vec::MoveItems<Json>), JsonDeserializerListState(vec::MoveItems<Json>),
JsonDeserializerObjectState(treemap::MoveEntries<string::String, Json>), JsonDeserializerObjectState(tree_map::MoveEntries<string::String, Json>),
JsonDeserializerEndState, JsonDeserializerEndState,
} }
@ -2237,7 +2237,7 @@ impl<Iter: Iterator<u8>> de::Deserializer<ParserError> for Parser<Iter> {
None => { return Ok(None); } None => { return Ok(None); }
}; };
Ok(Some(fields.iter().position(|field| **field == s.as_slice()))) Ok(Some(fields.iter().position(|field| *field == s.as_slice())))
} }
} }