Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stabilize repr128 #138285

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions compiler/rustc_error_codes/src/error_codes/E0658.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ An unstable feature was used.
Erroneous code example:

```compile_fail,E0658
#[repr(u128)] // error: use of unstable library feature 'repr128'
enum Foo {
Bar(u64),
}
use std::intrinsics; // error: use of unstable library feature `core_intrinsics`
```

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

```
#![feature(repr128)]
#![feature(core_intrinsics)]

#[repr(u128)] // ok!
enum Foo {
Bar(u64),
}
use std::intrinsics; // ok!
```

[rustup]: https://rust-lang.github.io/rustup/concepts/channels.html
2 changes: 2 additions & 0 deletions compiler/rustc_feature/src/accepted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ declare_features! (
(accepted, relaxed_adts, "1.19.0", Some(35626)),
/// Lessens the requirements for structs to implement `Unsize`.
(accepted, relaxed_struct_unsize, "1.58.0", Some(81793)),
/// Allows the `#[repr(i128)]` attribute for enums.
(accepted, repr128, "CURRENT_RUSTC_VERSION", Some(56071)),
/// Allows `repr(align(16))` struct attribute (RFC 1358).
(accepted, repr_align, "1.25.0", Some(33626)),
/// Allows using `#[repr(align(X))]` on enums with equivalent semantics
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -612,8 +612,6 @@ declare_features! (
(incomplete, ref_pat_eat_one_layer_2024_structural, "1.81.0", Some(123076)),
/// Allows using the `#[register_tool]` attribute.
(unstable, register_tool, "1.41.0", Some(66079)),
/// Allows the `#[repr(i128)]` attribute for enums.
(incomplete, repr128, "1.16.0", Some(56071)),
/// Allows `repr(simd)` and importing the various simd intrinsics.
(unstable, repr_simd, "1.4.0", Some(27731)),
/// Allows bounding the return type of AFIT/RPITIT.
Expand Down
15 changes: 1 addition & 14 deletions compiler/rustc_hir_analysis/src/check/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use rustc_middle::middle::stability::EvalResult;
use rustc_middle::ty::error::TypeErrorToStringExt;
use rustc_middle::ty::fold::{BottomUpFolder, fold_regions};
use rustc_middle::ty::layout::{LayoutError, MAX_SIMD_LANES};
use rustc_middle::ty::util::{Discr, IntTypeExt};
use rustc_middle::ty::util::Discr;
use rustc_middle::ty::{
AdtDef, GenericArgKind, RegionKind, TypeSuperVisitable, TypeVisitable, TypeVisitableExt,
};
Expand Down Expand Up @@ -1441,19 +1441,6 @@ fn check_enum(tcx: TyCtxt<'_>, def_id: LocalDefId) {
);
}

let repr_type_ty = def.repr().discr_type().to_ty(tcx);
if repr_type_ty == tcx.types.i128 || repr_type_ty == tcx.types.u128 {
if !tcx.features().repr128() {
feature_err(
&tcx.sess,
sym::repr128,
tcx.def_span(def_id),
"repr with 128-bit type is unstable",
)
.emit();
}
}

for v in def.variants() {
if let ty::VariantDiscr::Explicit(discr_def_id) = v.discr {
tcx.ensure_ok().typeck(discr_def_id.expect_local());
Expand Down
18 changes: 0 additions & 18 deletions src/doc/unstable-book/src/language-features/repr128.md

This file was deleted.

3 changes: 1 addition & 2 deletions src/tools/clippy/tests/ui/auxiliary/proc_macro_attr.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![feature(repr128, proc_macro_hygiene, proc_macro_quote, box_patterns)]
#![allow(incomplete_features)]
#![feature(proc_macro_hygiene, proc_macro_quote, box_patterns)]
#![allow(clippy::useless_conversion, clippy::uninlined_format_args)]

extern crate proc_macro;
Expand Down
3 changes: 1 addition & 2 deletions src/tools/clippy/tests/ui/auxiliary/proc_macro_derive.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![feature(repr128, proc_macro_quote, proc_macro_span)]
#![allow(incomplete_features)]
#![feature(proc_macro_quote, proc_macro_span)]
#![allow(clippy::field_reassign_with_default)]
#![allow(clippy::eq_op)]
#![allow(clippy::literal_string_with_formatting_args)]
Expand Down
2 changes: 0 additions & 2 deletions src/tools/clippy/tests/ui/cast.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//@no-rustfix

#![feature(repr128)]
#![allow(incomplete_features)]
#![warn(
clippy::cast_precision_loss,
clippy::cast_possible_truncation,
Expand Down
Loading
Loading