From b0e55a83a82bae26851f442859acace2b94f5028 Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Tue, 23 Aug 2016 03:56:52 +0300 Subject: Such large. Very 128. Much bits. This commit introduces 128-bit integers. Stage 2 builds and produces a working compiler which understands and supports 128-bit integers throughout. The general strategy used is to have rustc_i128 module which provides aliases for iu128, equal to iu64 in stage9 and iu128 later. Since nowhere in rustc we rely on large numbers being supported, this strategy is good enough to get past the first bootstrap stages to end up with a fully working 128-bit capable compiler. In order for this strategy to work, number of locations had to be changed to use associated max_value/min_value instead of MAX/MIN constants as well as the min_value (or was it max_value?) had to be changed to use xor instead of shift so both 64-bit and 128-bit based consteval works (former not necessarily producing the right results in stage1). This commit includes manual merge conflict resolution changes from a rebase by @est31. --- src/libstd/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/libstd') diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index fc5c6968544..f1e3996e825 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -301,6 +301,7 @@ #![feature(unwind_attributes)] #![feature(vec_push_all)] #![feature(zero_one)] +#![feature(i128)] #![cfg_attr(test, feature(update_panic_count))] // Explicitly import the prelude. The compiler uses this same unstable attribute @@ -395,6 +396,9 @@ pub use core::i16; pub use core::i32; #[stable(feature = "rust1", since = "1.0.0")] pub use core::i64; +#[unstable(feature = "i128", issue = "35118")] +#[cfg(not(stage0))] +pub use core::i128; #[stable(feature = "rust1", since = "1.0.0")] pub use core::usize; #[stable(feature = "rust1", since = "1.0.0")] @@ -423,6 +427,9 @@ pub use core_collections::string; pub use core_collections::vec; #[stable(feature = "rust1", since = "1.0.0")] pub use std_unicode::char; +#[unstable(feature = "i128", issue = "35118")] +#[cfg(not(stage0))] +pub use core::u128; pub mod f32; pub mod f64; -- cgit 1.4.1-3-g733a5 From 85ec09187c5d75a49659a82882a97cc93baff5af Mon Sep 17 00:00:00 2001 From: est31 Date: Mon, 21 Nov 2016 05:40:35 +0100 Subject: Make rustdoc aware of the primitive i128 type Many thanks to ollie27 for spotting all the places. --- src/librustdoc/clean/inline.rs | 2 ++ src/librustdoc/clean/mod.rs | 2 ++ src/libstd/primitive_docs.rs | 22 ++++++++++++++++++++++ 3 files changed, 26 insertions(+) (limited to 'src/libstd') diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index cba5e1ba6f3..93854193762 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -268,11 +268,13 @@ pub fn build_impls(cx: &DocContext, did: DefId) -> Vec { tcx.lang_items.i16_impl(), tcx.lang_items.i32_impl(), tcx.lang_items.i64_impl(), + tcx.lang_items.i128_impl(), tcx.lang_items.usize_impl(), tcx.lang_items.u8_impl(), tcx.lang_items.u16_impl(), tcx.lang_items.u32_impl(), tcx.lang_items.u64_impl(), + tcx.lang_items.u128_impl(), tcx.lang_items.f32_impl(), tcx.lang_items.f64_impl(), tcx.lang_items.char_impl(), diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 5978791fbc7..e0a26ca3181 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1595,11 +1595,13 @@ impl PrimitiveType { "i16" => Some(PrimitiveType::I16), "i32" => Some(PrimitiveType::I32), "i64" => Some(PrimitiveType::I64), + "i128" => Some(PrimitiveType::I128), "usize" => Some(PrimitiveType::Usize), "u8" => Some(PrimitiveType::U8), "u16" => Some(PrimitiveType::U16), "u32" => Some(PrimitiveType::U32), "u64" => Some(PrimitiveType::U64), + "u128" => Some(PrimitiveType::U128), "bool" => Some(PrimitiveType::Bool), "char" => Some(PrimitiveType::Char), "str" => Some(PrimitiveType::Str), diff --git a/src/libstd/primitive_docs.rs b/src/libstd/primitive_docs.rs index 54dde6681e1..5981b482a97 100644 --- a/src/libstd/primitive_docs.rs +++ b/src/libstd/primitive_docs.rs @@ -597,6 +597,17 @@ mod prim_i32 { } /// mod prim_i64 { } +#[doc(primitive = "i128")] +// +/// The 128-bit signed integer type. +/// +/// *[See also the `std::i128` module](i128/index.html).* +/// +/// However, please note that examples are shared between primitive integer +/// types. So it's normal if you see usage of types like `i8` in there. +/// +mod prim_i128 { } + #[doc(primitive = "u8")] // /// The 8-bit unsigned integer type. @@ -641,6 +652,17 @@ mod prim_u32 { } /// mod prim_u64 { } +#[doc(primitive = "u128")] +// +/// The 128-bit unsigned integer type. +/// +/// *[See also the `std::u128` module](u128/index.html).* +/// +/// However, please note that examples are shared between primitive integer +/// types. So it's normal if you see usage of types like `u8` in there. +/// +mod prim_u128 { } + #[doc(primitive = "isize")] // /// The pointer-sized signed integer type. -- cgit 1.4.1-3-g733a5