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

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

-25
This file was deleted.
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

+1-1
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

+1-1
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

+2-2
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

+1-1
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

+2-2
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

+15-30
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

+2-2
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")] }

src/libcore/tests/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#![feature(fmt_internals)]
2424
#![feature(hashmap_internals)]
2525
#![feature(iterator_step_by)]
26-
#![feature(i128_type)]
26+
#![cfg_attr(stage0, feature(i128_type))]
2727
#![cfg_attr(stage0, feature(inclusive_range_syntax))]
2828
#![feature(iterator_try_fold)]
2929
#![feature(iterator_flatten)]

src/libproc_macro/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
test(no_crate_inject, attr(deny(warnings))),
3535
test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))))]
3636

37-
#![feature(i128_type)]
37+
#![cfg_attr(stage0, feature(i128_type))]
3838
#![feature(rustc_private)]
3939
#![feature(staged_api)]
4040
#![feature(lang_items)]

src/librustc/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@
5252
#![feature(entry_or_default)]
5353
#![feature(from_ref)]
5454
#![feature(fs_read_write)]
55-
#![feature(i128)]
56-
#![feature(i128_type)]
55+
#![cfg_attr(stage0, feature(i128_type, i128))]
5756
#![cfg_attr(stage0, feature(inclusive_range_syntax))]
5857
#![cfg_attr(windows, feature(libc))]
5958
#![feature(match_default_bindings)]

src/librustc_apfloat/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
#![deny(warnings)]
4747
#![forbid(unsafe_code)]
4848

49-
#![feature(i128_type)]
5049
#![cfg_attr(stage0, feature(slice_patterns))]
50+
#![cfg_attr(stage0, feature(i128_type))]
5151
#![feature(try_from)]
5252

5353
// See librustc_cratesio_shim/Cargo.toml for a comment explaining this.

src/librustc_apfloat/tests/ieee.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(i128_type)]
11+
#![cfg_attr(stage0, feature(i128_type))]
1212

1313
#[macro_use]
1414
extern crate rustc_apfloat;

src/librustc_const_eval/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#![feature(box_patterns)]
2424
#![feature(box_syntax)]
2525
#![feature(macro_lifetime_matcher)]
26-
#![feature(i128_type)]
26+
#![cfg_attr(stage0, feature(i128_type))]
2727
#![feature(from_ref)]
2828

2929
extern crate arena;

src/librustc_const_math/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
html_root_url = "https://doc.rust-lang.org/nightly/")]
2020
#![deny(warnings)]
2121

22-
#![feature(i128)]
23-
#![feature(i128_type)]
22+
#![cfg_attr(stage0, feature(i128_type, i128))]
2423

2524
extern crate rustc_apfloat;
2625

src/librustc_data_structures/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@
2626
#![feature(unboxed_closures)]
2727
#![feature(fn_traits)]
2828
#![feature(unsize)]
29-
#![feature(i128_type)]
30-
#![feature(i128)]
3129
#![cfg_attr(stage0, feature(conservative_impl_trait))]
30+
#![cfg_attr(stage0, feature(i128_type, i128))]
3231
#![feature(specialization)]
3332
#![feature(optin_builtin_traits)]
3433
#![feature(underscore_lifetimes)]

src/librustc_errors/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#![feature(range_contains)]
1919
#![cfg_attr(unix, feature(libc))]
2020
#![cfg_attr(stage0, feature(conservative_impl_trait))]
21-
#![feature(i128_type)]
21+
#![cfg_attr(stage0, feature(i128_type))]
2222
#![feature(optin_builtin_traits)]
2323

2424
extern crate atty;

src/librustc_incremental/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
#![cfg_attr(stage0, feature(conservative_impl_trait))]
1919
#![feature(fs_read_write)]
20-
#![feature(i128_type)]
20+
#![cfg_attr(stage0, feature(i128_type))]
2121
#![cfg_attr(stage0, feature(inclusive_range_syntax))]
2222
#![feature(specialization)]
2323

src/librustc_lint/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#![cfg_attr(test, feature(test))]
2828
#![feature(box_patterns)]
2929
#![feature(box_syntax)]
30-
#![feature(i128_type)]
30+
#![cfg_attr(stage0, feature(i128_type))]
3131
#![feature(macro_vis_matcher)]
3232
#![feature(quote)]
3333
#![feature(rustc_diagnostic_macros)]

src/librustc_metadata/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#![feature(box_patterns)]
1717
#![cfg_attr(stage0, feature(conservative_impl_trait))]
1818
#![feature(fs_read_write)]
19-
#![feature(i128_type)]
19+
#![cfg_attr(stage0, feature(i128_type))]
2020
#![feature(libc)]
2121
#![feature(macro_lifetime_matcher)]
2222
#![feature(proc_macro_internals)]

src/librustc_mir/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
2727
#![feature(decl_macro)]
2828
#![feature(dyn_trait)]
2929
#![feature(fs_read_write)]
30-
#![feature(i128_type)]
30+
#![cfg_attr(stage0, feature(i128_type))]
3131
#![cfg_attr(stage0, feature(inclusive_range_syntax))]
3232
#![feature(macro_vis_matcher)]
3333
#![feature(match_default_bindings)]

src/librustc_resolve/lib.rs

+1-12
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ use syntax::ast::{FnDecl, ForeignItem, ForeignItemKind, GenericParam, Generics};
5757
use syntax::ast::{Item, ItemKind, ImplItem, ImplItemKind};
5858
use syntax::ast::{Label, Local, Mutability, Pat, PatKind, Path};
5959
use syntax::ast::{QSelf, TraitItemKind, TraitRef, Ty, TyKind};
60-
use syntax::feature_gate::{feature_err, emit_feature_err, GateIssue};
60+
use syntax::feature_gate::{feature_err, GateIssue};
6161
use syntax::parse::token;
6262
use syntax::ptr::P;
6363

@@ -3172,17 +3172,6 @@ impl<'a> Resolver<'a> {
31723172
self.primitive_type_table.primitive_types
31733173
.contains_key(&path[0].node.name) => {
31743174
let prim = self.primitive_type_table.primitive_types[&path[0].node.name];
3175-
match prim {
3176-
TyUint(UintTy::U128) | TyInt(IntTy::I128) => {
3177-
if !self.session.features_untracked().i128_type {
3178-
emit_feature_err(&self.session.parse_sess,
3179-
"i128_type", span, GateIssue::Language,
3180-
"128-bit type is unstable");
3181-
3182-
}
3183-
}
3184-
_ => {}
3185-
}
31863175
PathResolution::with_unresolved_segments(Def::PrimTy(prim), path.len() - 1)
31873176
}
31883177
PathResult::Module(module) => PathResolution::new(module.def().unwrap()),

src/librustc_trans/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
#![feature(custom_attribute)]
2525
#![feature(fs_read_write)]
2626
#![allow(unused_attributes)]
27-
#![feature(i128_type)]
28-
#![feature(i128)]
27+
#![cfg_attr(stage0, feature(i128_type, i128))]
2928
#![cfg_attr(stage0, feature(inclusive_range_syntax))]
3029
#![feature(libc)]
3130
#![feature(quote)]

src/librustc_trans_utils/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#![feature(box_syntax)]
2222
#![feature(custom_attribute)]
2323
#![allow(unused_attributes)]
24-
#![feature(i128_type)]
24+
#![cfg_attr(stage0, feature(i128_type))]
2525
#![feature(quote)]
2626
#![feature(rustc_diagnostic_macros)]
2727
#![cfg_attr(stage0, feature(conservative_impl_trait))]

src/librustc_typeck/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ This API is completely unstable and subject to change.
8686
#![feature(refcell_replace_swap)]
8787
#![feature(rustc_diagnostic_macros)]
8888
#![feature(slice_patterns)]
89-
#![feature(i128_type)]
89+
#![cfg_attr(stage0, feature(i128_type))]
9090
#![cfg_attr(stage0, feature(never_type))]
9191

9292
#[macro_use] extern crate log;

src/libserialize/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Core encoding and decoding interfaces.
2323

2424
#![feature(box_syntax)]
2525
#![feature(core_intrinsics)]
26-
#![feature(i128_type)]
26+
#![cfg_attr(stage0, feature(i128_type))]
2727
#![feature(specialization)]
2828
#![cfg_attr(test, feature(test))]
2929

0 commit comments

Comments
 (0)