about summary refs log tree commit diff
path: root/src/librustc_data_structures
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-12-31 18:54:31 +0000
committerbors <bors@rust-lang.org>2016-12-31 18:54:31 +0000
commit38bd207626fa46445d58404099b0a2f0bf8e0934 (patch)
tree0763e040e47b547921f654e31894f7a67145df6d /src/librustc_data_structures
parent6185c5445210966cfd1acb011b4faf4b4eaf9d97 (diff)
parent29e01af6a68817a12c1fc5fa04c483d2200c3cbb (diff)
downloadrust-38bd207626fa46445d58404099b0a2f0bf8e0934.tar.gz
rust-38bd207626fa46445d58404099b0a2f0bf8e0934.zip
Auto merge of #38482 - est31:i128, r=eddyb
i128 and u128 support

Brings i128 and u128 support to nightly rust, behind a feature flag. The goal of this PR is to do the bulk of the work for 128 bit integer support. Smaller but just as tricky features needed for stabilisation like 128 bit enum discriminants are left for future PRs.

Rebased version of  #37900, which in turn was a rebase + improvement of #35954 . Sadly I couldn't reopen #37900 due to github. There goes my premium position in the homu queue...

[plugin-breaking-change]

cc #35118 (tracking issue)
Diffstat (limited to 'src/librustc_data_structures')
-rw-r--r--src/librustc_data_structures/Cargo.toml1
-rw-r--r--src/librustc_data_structures/lib.rs2
-rw-r--r--src/librustc_data_structures/stable_hasher.rs5
3 files changed, 6 insertions, 2 deletions
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