Skip to content

Commit 188e693

Browse files
committed
Auto merge of #49101 - mark-i-m:stabilize_i128, r=nagisa
Stabilize 128-bit integers 🎉 cc #35118 EDIT: This should be merged only after the following have been merged: - [x] rust-lang/compiler-builtins#236 - [x] rust-lang/book#1230
2 parents ab8b961 + 140bf94 commit 188e693

File tree

60 files changed

+106
-301
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+106
-301
lines changed

src/doc/unstable-book/src/language-features/i128-type.md

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# `repr128`
2+
3+
The tracking issue for this feature is: [#35118]
4+
5+
[#35118]: https://github.com/rust-lang/rust/issues/35118
6+
7+
------------------------
8+
9+
The `repr128` feature adds support for `#[repr(u128)]` on `enum`s.
10+
11+
```rust
12+
#![feature(repr128)]
13+
14+
#[repr(u128)]
15+
enum Foo {
16+
Bar(u64),
17+
}
18+
```

src/liballoc/benches/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#![deny(warnings)]
1212

13-
#![feature(i128_type)]
13+
#![cfg_attr(stage0, feature(i128_type))]
1414
#![feature(rand)]
1515
#![feature(repr_simd)]
1616
#![feature(test)]

src/liballoc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
#![feature(from_ref)]
9898
#![feature(fundamental)]
9999
#![feature(generic_param_attrs)]
100-
#![feature(i128_type)]
100+
#![cfg_attr(stage0, feature(i128_type))]
101101
#![feature(iter_rfold)]
102102
#![feature(lang_items)]
103103
#![feature(needs_allocator)]

src/libcore/hash/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ pub trait Hasher {
308308
}
309309
/// Writes a single `u128` into this hasher.
310310
#[inline]
311-
#[unstable(feature = "i128", issue = "35118")]
311+
#[stable(feature = "i128", since = "1.26.0")]
312312
fn write_u128(&mut self, i: u128) {
313313
self.write(&unsafe { mem::transmute::<_, [u8; 16]>(i) })
314314
}
@@ -348,7 +348,7 @@ pub trait Hasher {
348348
}
349349
/// Writes a single `i128` into this hasher.
350350
#[inline]
351-
#[unstable(feature = "i128", issue = "35118")]
351+
#[stable(feature = "i128", since = "1.26.0")]
352352
fn write_i128(&mut self, i: i128) {
353353
self.write_u128(i as u128)
354354
}

src/libcore/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
#![feature(doc_spotlight)]
7979
#![feature(fn_must_use)]
8080
#![feature(fundamental)]
81-
#![feature(i128_type)]
81+
#![cfg_attr(stage0, feature(i128_type))]
8282
#![cfg_attr(stage0, feature(inclusive_range_syntax))]
8383
#![feature(intrinsics)]
8484
#![feature(iterator_flatten)]

src/libcore/num/i128.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
//!
1313
//! *[See also the `i128` primitive type](../../std/primitive.i128.html).*
1414
15-
#![unstable(feature = "i128", issue="35118")]
15+
#![stable(feature = "i128", since = "1.26.0")]
1616

17-
int_module! { i128, #[unstable(feature = "i128", issue="35118")] }
17+
int_module! { i128, #[stable(feature = "i128", since="1.26.0")] }

src/libcore/num/mod.rs

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,8 @@ nonzero_integers! {
9797
NonZeroU16(u16); NonZeroI16(i16);
9898
NonZeroU32(u32); NonZeroI32(i32);
9999
NonZeroU64(u64); NonZeroI64(i64);
100-
NonZeroUsize(usize); NonZeroIsize(isize);
101-
}
102-
103-
nonzero_integers! {
104-
// Change this to `#[unstable(feature = "i128", issue = "35118")]`
105-
// if other NonZero* integer types are stabilizied before 128-bit integers
106-
#[unstable(feature = "nonzero", issue = "49137")]
107100
NonZeroU128(u128); NonZeroI128(i128);
101+
NonZeroUsize(usize); NonZeroIsize(isize);
108102
}
109103

110104
/// Provides intentionally-wrapped arithmetic on `T`.
@@ -1635,11 +1629,7 @@ impl i64 {
16351629
#[lang = "i128"]
16361630
impl i128 {
16371631
int_impl! { i128, i128, u128, 128, -170141183460469231731687303715884105728,
1638-
170141183460469231731687303715884105727, "#![feature(i128_type)]
1639-
#![feature(i128)]
1640-
# fn main() {
1641-
", "
1642-
# }" }
1632+
170141183460469231731687303715884105727, "", "" }
16431633
}
16441634

16451635
#[cfg(target_pointer_width = "16")]
@@ -3493,12 +3483,7 @@ impl u64 {
34933483

34943484
#[lang = "u128"]
34953485
impl u128 {
3496-
uint_impl! { u128, u128, 128, 340282366920938463463374607431768211455, "#![feature(i128_type)]
3497-
#![feature(i128)]
3498-
3499-
# fn main() {
3500-
", "
3501-
# }" }
3486+
uint_impl! { u128, u128, 128, 340282366920938463463374607431768211455, "", "" }
35023487
}
35033488

35043489
#[cfg(target_pointer_width = "16")]
@@ -4055,39 +4040,39 @@ macro_rules! impl_from {
40554040
impl_from! { u8, u16, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
40564041
impl_from! { u8, u32, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
40574042
impl_from! { u8, u64, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
4058-
impl_from! { u8, u128, #[unstable(feature = "i128", issue = "35118")] }
4043+
impl_from! { u8, u128, #[stable(feature = "i128", since = "1.26.0")] }
40594044
impl_from! { u8, usize, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
40604045
impl_from! { u16, u32, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
40614046
impl_from! { u16, u64, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
4062-
impl_from! { u16, u128, #[unstable(feature = "i128", issue = "35118")] }
4047+
impl_from! { u16, u128, #[stable(feature = "i128", since = "1.26.0")] }
40634048
impl_from! { u32, u64, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
4064-
impl_from! { u32, u128, #[unstable(feature = "i128", issue = "35118")] }
4065-
impl_from! { u64, u128, #[unstable(feature = "i128", issue = "35118")] }
4049+
impl_from! { u32, u128, #[stable(feature = "i128", since = "1.26.0")] }
4050+
impl_from! { u64, u128, #[stable(feature = "i128", since = "1.26.0")] }
40664051

40674052
// Signed -> Signed
40684053
impl_from! { i8, i16, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
40694054
impl_from! { i8, i32, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
40704055
impl_from! { i8, i64, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
4071-
impl_from! { i8, i128, #[unstable(feature = "i128", issue = "35118")] }
4056+
impl_from! { i8, i128, #[stable(feature = "i128", since = "1.26.0")] }
40724057
impl_from! { i8, isize, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
40734058
impl_from! { i16, i32, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
40744059
impl_from! { i16, i64, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
4075-
impl_from! { i16, i128, #[unstable(feature = "i128", issue = "35118")] }
4060+
impl_from! { i16, i128, #[stable(feature = "i128", since = "1.26.0")] }
40764061
impl_from! { i32, i64, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
4077-
impl_from! { i32, i128, #[unstable(feature = "i128", issue = "35118")] }
4078-
impl_from! { i64, i128, #[unstable(feature = "i128", issue = "35118")] }
4062+
impl_from! { i32, i128, #[stable(feature = "i128", since = "1.26.0")] }
4063+
impl_from! { i64, i128, #[stable(feature = "i128", since = "1.26.0")] }
40794064

40804065
// Unsigned -> Signed
40814066
impl_from! { u8, i16, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
40824067
impl_from! { u8, i32, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
40834068
impl_from! { u8, i64, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
4084-
impl_from! { u8, i128, #[unstable(feature = "i128", issue = "35118")] }
4069+
impl_from! { u8, i128, #[stable(feature = "i128", since = "1.26.0")] }
40854070
impl_from! { u16, i32, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
40864071
impl_from! { u16, i64, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
4087-
impl_from! { u16, i128, #[unstable(feature = "i128", issue = "35118")] }
4072+
impl_from! { u16, i128, #[stable(feature = "i128", since = "1.26.0")] }
40884073
impl_from! { u32, i64, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
4089-
impl_from! { u32, i128, #[unstable(feature = "i128", issue = "35118")] }
4090-
impl_from! { u64, i128, #[unstable(feature = "i128", issue = "35118")] }
4074+
impl_from! { u32, i128, #[stable(feature = "i128", since = "1.26.0")] }
4075+
impl_from! { u64, i128, #[stable(feature = "i128", since = "1.26.0")] }
40914076

40924077
// Note: integers can only be represented with full precision in a float if
40934078
// they fit in the significand, which is 24 bits in f32 and 53 bits in f64.

src/libcore/num/u128.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
//!
1313
//! *[See also the `u128` primitive type](../../std/primitive.u128.html).*
1414
15-
#![unstable(feature = "i128", issue="35118")]
16-
uint_module! { u128, #[unstable(feature = "i128", issue="35118")] }
15+
#![stable(feature = "i128", since = "1.26.0")]
16+
uint_module! { u128, #[stable(feature = "i128", since="1.26.0")] }

0 commit comments

Comments
 (0)