update to rust head

This commit is contained in:
Erick Tryzelaar
2014-12-17 23:00:05 -08:00
parent bfc1b25fcd
commit 29242ee6a6
7 changed files with 438 additions and 214 deletions
+86 -42
View File
@@ -95,61 +95,102 @@ mod decoder {
}
// Compound types:
fn read_enum<T>(&mut self, _name: &str, _f: |&mut IntDecoder| -> Result<T, Error>) -> Result<T, Error> { Err(SyntaxError) }
fn read_enum<T, F>(&mut self, _name: &str, _f: F) -> Result<T, Error> where
F: FnOnce(&mut IntDecoder) -> Result<T, Error>,
{
Err(Error::SyntaxError)
}
fn read_enum_variant<T>(&mut self,
_names: &[&str],
_f: |&mut IntDecoder, uint| -> Result<T, Error>)
-> Result<T, Error> { Err(SyntaxError) }
fn read_enum_variant_arg<T>(&mut self,
_a_idx: uint,
_f: |&mut IntDecoder| -> Result<T, Error>)
-> Result<T, Error> { Err(SyntaxError) }
fn read_enum_variant<T, F>(&mut self, _names: &[&str], _f: F) -> Result<T, Error> where
F: FnOnce(&mut IntDecoder, uint) -> Result<T, Error>,
{
Err(Error::SyntaxError)
}
fn read_enum_struct_variant<T>(&mut self,
_names: &[&str],
_f: |&mut IntDecoder, uint| -> Result<T, Error>)
-> Result<T, Error> { Err(SyntaxError) }
fn read_enum_struct_variant_field<T>(&mut self,
_f_name: &str,
_f_idx: uint,
_f: |&mut IntDecoder| -> Result<T, Error>)
-> Result<T, Error> { Err(SyntaxError) }
fn read_enum_variant_arg<T, F>(&mut self, _a_idx: uint, _f: F) -> Result<T, Error> where
F: FnOnce(&mut IntDecoder) -> Result<T, Error>,
{
Err(Error::SyntaxError)
}
fn read_struct<T>(&mut self, _s_name: &str, _len: uint, _f: |&mut IntDecoder| -> Result<T, Error>)
-> Result<T, Error> { Err(SyntaxError) }
fn read_struct_field<T>(&mut self,
_f_name: &str,
_f_idx: uint,
_f: |&mut IntDecoder| -> Result<T, Error>)
-> Result<T, Error> { Err(SyntaxError) }
fn read_enum_struct_variant<T, F>(&mut self, _names: &[&str], _f: F) -> Result<T, Error> where
F: FnOnce(&mut IntDecoder, uint) -> Result<T, Error>,
{
Err(Error::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_enum_struct_variant_field<T, F>(&mut self, _f_name: &str, _f_idx: uint, _f: F) -> Result<T, Error> where
F: FnOnce(&mut IntDecoder) -> Result<T, Error>,
{
Err(Error::SyntaxError)
}
fn read_tuple_struct<T>(&mut self,
_s_name: &str,
_len: uint,
_f: |&mut IntDecoder| -> Result<T, Error>)
-> Result<T, Error> { Err(SyntaxError) }
fn read_tuple_struct_arg<T>(&mut self,
_a_idx: uint,
_f: |&mut IntDecoder| -> Result<T, Error>)
-> Result<T, Error> { Err(SyntaxError) }
fn read_struct<T, F>(&mut self, _s_name: &str, _len: uint, _f: F) -> Result<T, Error> where
F: FnOnce(&mut IntDecoder) -> Result<T, Error>,
{
Err(Error::SyntaxError)
}
fn read_struct_field<T, F>(&mut self, _f_name: &str, _f_idx: uint, _f: F) -> Result<T, Error> where
F: FnOnce(&mut IntDecoder) -> Result<T, Error>,
{
Err(Error::SyntaxError)
}
fn read_tuple<T, F>(&mut self, _len: uint, _f: F) -> Result<T, Error> where
F: FnOnce(&mut IntDecoder) -> Result<T, Error>,
{
Err(Error::SyntaxError)
}
fn read_tuple_arg<T, F>(&mut self, _a_idx: uint, _f: F) -> Result<T, Error> where
F: FnOnce(&mut IntDecoder) -> Result<T, Error>,
{
Err(Error::SyntaxError)
}
fn read_tuple_struct<T, F>(&mut self, _s_name: &str, _len: uint, _f: F) -> Result<T, Error> where
F: FnOnce(&mut IntDecoder) -> Result<T, Error>,
{
Err(Error::SyntaxError)
}
fn read_tuple_struct_arg<T, F>(&mut self, _a_idx: uint, _f: F) -> Result<T, Error> where
F: FnOnce(&mut IntDecoder) -> Result<T, Error>,
{
Err(Error::SyntaxError)
}
// Specialized types:
fn read_option<T>(&mut self, _f: |&mut IntDecoder, bool| -> Result<T, Error>) -> Result<T, Error> { Err(SyntaxError) }
fn read_option<T, F>(&mut self, _f: F) -> Result<T, Error> where
F: FnOnce(&mut IntDecoder, bool) -> Result<T, Error>,
{
Err(SyntaxError)
}
fn read_seq<T>(&mut self, _f: |&mut IntDecoder, uint| -> Result<T, Error>) -> Result<T, Error> { Err(SyntaxError) }
fn read_seq_elt<T>(&mut self, _idx: uint, _f: |&mut IntDecoder| -> Result<T, Error>) -> Result<T, Error> { Err(SyntaxError) }
fn read_seq<T, F>(&mut self, _f: F) -> Result<T, Error> where
F: FnOnce(&mut IntDecoder, uint) -> Result<T, Error>,
{
Err(SyntaxError)
}
fn read_seq_elt<T, F>(&mut self, _idx: uint, _f: F) -> Result<T, Error> where
F: FnOnce(&mut IntDecoder) -> Result<T, Error>,
{
Err(SyntaxError)
}
#[inline]
fn read_map<T>(&mut self, f: |&mut IntDecoder, uint| -> Result<T, Error>) -> Result<T, Error> {
fn read_map<T, F>(&mut self, f: F) -> Result<T, Error> where
F: FnOnce(&mut IntDecoder, uint) -> Result<T, Error>,
{
let len = self.len;
f(self, len)
}
#[inline]
fn read_map_elt_key<T>(&mut self, _idx: uint, f: |&mut IntDecoder| -> Result<T, Error>) -> Result<T, Error> {
fn read_map_elt_key<T, F>(&mut self, _idx: uint, f: F) -> Result<T, Error> where
F: FnOnce(&mut IntDecoder) -> Result<T, Error>,
{
match self.iter.next() {
Some((key, value)) => {
self.stack.push(IntValue(value));
@@ -161,8 +202,11 @@ mod decoder {
}
}
}
#[inline]
fn read_map_elt_val<T>(&mut self, _idx: uint, f: |&mut IntDecoder| -> Result<T, Error>) -> Result<T, Error> {
fn read_map_elt_val<T, F>(&mut self, _idx: uint, f: F) -> Result<T, Error> where
F: FnOnce(&mut IntDecoder) -> Result<T, Error>,
{
f(self)
}
}