Merge pull request #28 from mikedilger/rustc_changes

Fix for upstream rustc changes
This commit is contained in:
Ty 2015-03-31 14:38:53 -07:00
commit fdb5de2631
3 changed files with 4 additions and 3 deletions

View File

@ -45,7 +45,7 @@ fn main() {
// 8 bytes for the length of the vector, 4 bytes per float.
assert_eq!(encoded.len(), 8 + 4 * 4);
let decoded: World = bincode::decode(&encoded[]).unwrap();
let decoded: World = bincode::decode(&encoded[..]).unwrap();
assert!(world == decoded);
}

View File

@ -44,7 +44,7 @@ mod refbox;
///! let limit = bincode::SizeLimit::Bounded(20);
///!
///! let encoded: Vec<u8> = bincode::encode(&target, limit).unwrap();
///! let decoded: Option<String> = bincode::decode(&encoded[]).unwrap();
///! let decoded: Option<String> = bincode::decode(&encoded[..]).unwrap();
///! assert_eq!(target, decoded);
///! }
///! ```

View File

@ -123,7 +123,8 @@ impl<'a, R: Read> DecoderReader<'a, R> {
impl <'a, A> DecoderReader<'a, A> {
fn read_bytes<I>(&mut self, count: I) -> Result<(), DecodingError>
where I: NumCast {
self.read += cast(count).unwrap();
let count: u64 = cast(count).unwrap();
self.read += count;
match self.size_limit {
SizeLimit::Infinite => Ok(()),
SizeLimit::Bounded(x) if self.read <= x => Ok(()),