Skip to content

Commit 30f13ca

Browse files
committed
Stabilise repr128
1 parent ed897d5 commit 30f13ca

File tree

30 files changed

+109
-241
lines changed

30 files changed

+109
-241
lines changed

compiler/rustc_error_codes/src/error_codes/E0658.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ An unstable feature was used.
33
Erroneous code example:
44

55
```compile_fail,E0658
6-
#[repr(u128)] // error: use of unstable library feature 'repr128'
7-
enum Foo {
8-
Bar(u64),
9-
}
6+
use std::intrinsics; // error: use of unstable library feature `core_intrinsics`
107
```
118

129
If you're using a stable or a beta version of rustc, you won't be able to use
@@ -17,12 +14,9 @@ If you're using a nightly version of rustc, just add the corresponding feature
1714
to be able to use it:
1815

1916
```
20-
#![feature(repr128)]
17+
#![feature(core_intrinsics)]
2118
22-
#[repr(u128)] // ok!
23-
enum Foo {
24-
Bar(u64),
25-
}
19+
use std::intrinsics; // ok!
2620
```
2721

2822
[rustup]: https://rust-lang.github.io/rustup/concepts/channels.html

compiler/rustc_feature/src/accepted.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,8 @@ declare_features! (
350350
(accepted, relaxed_adts, "1.19.0", Some(35626)),
351351
/// Lessens the requirements for structs to implement `Unsize`.
352352
(accepted, relaxed_struct_unsize, "1.58.0", Some(81793)),
353+
/// Allows the `#[repr(i128)]` attribute for enums.
354+
(accepted, repr128, "CURRENT_RUSTC_VERSION", Some(56071)),
353355
/// Allows `repr(align(16))` struct attribute (RFC 1358).
354356
(accepted, repr_align, "1.25.0", Some(33626)),
355357
/// Allows using `#[repr(align(X))]` on enums with equivalent semantics

compiler/rustc_feature/src/unstable.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,8 +612,6 @@ declare_features! (
612612
(incomplete, ref_pat_eat_one_layer_2024_structural, "1.81.0", Some(123076)),
613613
/// Allows using the `#[register_tool]` attribute.
614614
(unstable, register_tool, "1.41.0", Some(66079)),
615-
/// Allows the `#[repr(i128)]` attribute for enums.
616-
(incomplete, repr128, "1.16.0", Some(56071)),
617615
/// Allows `repr(simd)` and importing the various simd intrinsics.
618616
(unstable, repr_simd, "1.4.0", Some(27731)),
619617
/// Allows bounding the return type of AFIT/RPITIT.

compiler/rustc_hir_analysis/src/check/check.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use rustc_middle::middle::stability::EvalResult;
2020
use rustc_middle::ty::error::TypeErrorToStringExt;
2121
use rustc_middle::ty::fold::{BottomUpFolder, fold_regions};
2222
use rustc_middle::ty::layout::{LayoutError, MAX_SIMD_LANES};
23-
use rustc_middle::ty::util::{Discr, IntTypeExt};
23+
use rustc_middle::ty::util::Discr;
2424
use rustc_middle::ty::{
2525
AdtDef, GenericArgKind, RegionKind, TypeSuperVisitable, TypeVisitable, TypeVisitableExt,
2626
};
@@ -1441,19 +1441,6 @@ fn check_enum(tcx: TyCtxt<'_>, def_id: LocalDefId) {
14411441
);
14421442
}
14431443

1444-
let repr_type_ty = def.repr().discr_type().to_ty(tcx);
1445-
if repr_type_ty == tcx.types.i128 || repr_type_ty == tcx.types.u128 {
1446-
if !tcx.features().repr128() {
1447-
feature_err(
1448-
&tcx.sess,
1449-
sym::repr128,
1450-
tcx.def_span(def_id),
1451-
"repr with 128-bit type is unstable",
1452-
)
1453-
.emit();
1454-
}
1455-
}
1456-
14571444
for v in def.variants() {
14581445
if let ty::VariantDiscr::Explicit(discr_def_id) = v.discr {
14591446
tcx.ensure_ok().typeck(discr_def_id.expect_local());

src/doc/unstable-book/src/language-features/repr128.md

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/tools/clippy/tests/ui/auxiliary/proc_macro_attr.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#![feature(repr128, proc_macro_hygiene, proc_macro_quote, box_patterns)]
2-
#![allow(incomplete_features)]
1+
#![feature(proc_macro_hygiene, proc_macro_quote, box_patterns)]
32
#![allow(clippy::useless_conversion, clippy::uninlined_format_args)]
43

54
extern crate proc_macro;

src/tools/clippy/tests/ui/auxiliary/proc_macro_derive.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#![feature(repr128, proc_macro_quote, proc_macro_span)]
2-
#![allow(incomplete_features)]
1+
#![feature(proc_macro_quote, proc_macro_span)]
32
#![allow(clippy::field_reassign_with_default)]
43
#![allow(clippy::eq_op)]
54
#![allow(clippy::literal_string_with_formatting_args)]

src/tools/clippy/tests/ui/cast.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@no-rustfix
22

3-
#![feature(repr128)]
4-
#![allow(incomplete_features)]
53
#![warn(
64
clippy::cast_precision_loss,
75
clippy::cast_possible_truncation,

0 commit comments

Comments
 (0)