From 0a481fe5d2a028df806e68a1b91177924a0cda35 Mon Sep 17 00:00:00 2001 From: est31 Date: Fri, 16 Dec 2016 18:01:32 +0100 Subject: [PATCH] Fix rebase fallout and compilation fixes --- src/Cargo.lock | 1 + src/librustc_data_structures/Cargo.toml | 1 + src/librustc_data_structures/lib.rs | 2 ++ src/librustc_data_structures/stable_hasher.rs | 5 +++-- src/libserialize/leb128.rs | 4 ++-- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Cargo.lock b/src/Cargo.lock index b4455a34e49..6acdc8102a7 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -330,6 +330,7 @@ name = "rustc_data_structures" version = "0.0.0" dependencies = [ "log 0.0.0", + "rustc_i128 0.0.0", "serialize 0.0.0", ] diff --git a/src/librustc_data_structures/Cargo.toml b/src/librustc_data_structures/Cargo.toml index e2e16059d98..bb610374810 100644 --- a/src/librustc_data_structures/Cargo.toml +++ b/src/librustc_data_structures/Cargo.toml @@ -11,3 +11,4 @@ crate-type = ["dylib"] [dependencies] log = { path = "../liblog" } serialize = { path = "../libserialize" } +rustc_i128 = { path = "../librustc_i128" } diff --git a/src/librustc_data_structures/lib.rs b/src/librustc_data_structures/lib.rs index 86f244d65dd..d3ec674daed 100644 --- a/src/librustc_data_structures/lib.rs +++ b/src/librustc_data_structures/lib.rs @@ -44,6 +44,8 @@ extern crate serialize as rustc_serialize; // used by deriving #[cfg(unix)] extern crate libc; +extern crate rustc_i128; + pub use rustc_serialize::hex::ToHex; pub mod array_vec; diff --git a/src/librustc_data_structures/stable_hasher.rs b/src/librustc_data_structures/stable_hasher.rs index ed97c3dde5e..87048eff5b7 100644 --- a/src/librustc_data_structures/stable_hasher.rs +++ b/src/librustc_data_structures/stable_hasher.rs @@ -13,13 +13,14 @@ use std::marker::PhantomData; use std::mem; use blake2b::Blake2bHasher; use rustc_serialize::leb128; +use rustc_i128::{u128,i128}; fn write_unsigned_leb128_to_buf(buf: &mut [u8; 16], value: u64) -> usize { - leb128::write_unsigned_leb128_to(value, |i, v| buf[i] = v) + leb128::write_unsigned_leb128_to(value as u128, |i, v| buf[i] = v) } fn write_signed_leb128_to_buf(buf: &mut [u8; 16], value: i64) -> usize { - leb128::write_signed_leb128_to(value, |i, v| buf[i] = v) + leb128::write_signed_leb128_to(value as i128, |i, v| buf[i] = v) } /// When hashing something that ends up affecting properties like symbol names. We diff --git a/src/libserialize/leb128.rs b/src/libserialize/leb128.rs index 55ae7ae10f4..392f332d508 100644 --- a/src/libserialize/leb128.rs +++ b/src/libserialize/leb128.rs @@ -26,7 +26,7 @@ fn write_to_vec(vec: &mut Vec, position: usize, byte: u8) { /// The callback `write` is called once for each position /// that is to be written to with the byte to be encoded /// at that position. -pub fn write_unsigned_leb128_to(mut value: u64, mut write: W) -> usize +pub fn write_unsigned_leb128_to(mut value: u128, mut write: W) -> usize where W: FnMut(usize, u8) { let mut position = 0; @@ -48,7 +48,7 @@ pub fn write_unsigned_leb128_to(mut value: u64, mut write: W) -> usize position } -pub fn write_unsigned_leb128(out: &mut Vec, start_position: usize, value: u64) -> usize { +pub fn write_unsigned_leb128(out: &mut Vec, start_position: usize, value: u128) -> usize { write_unsigned_leb128_to(value, |i, v| write_to_vec(out, start_position+i, v)) }