Skip to content

Commit 9af7de1

Browse files
Rollup merge of rust-lang#44262 - alexcrichton:repr-128-gate, r=nikomatsakis
rustc: Separately feature gate repr(i128) Brought up during the discussion of rust-lang#35118, the support for this is still somewhat buggy and so stabilization likely wants to be considered independently of the type itself.
2 parents 34035d2 + 51a478c commit 9af7de1

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

src/librustc_typeck/check/mod.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1554,9 +1554,12 @@ pub fn check_enum<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
15541554

15551555
let repr_type_ty = def.repr.discr_type().to_ty(tcx);
15561556
if repr_type_ty == tcx.types.i128 || repr_type_ty == tcx.types.u128 {
1557-
if !tcx.sess.features.borrow().i128_type {
1557+
if !tcx.sess.features.borrow().repr128 {
15581558
emit_feature_err(&tcx.sess.parse_sess,
1559-
"i128_type", sp, GateIssue::Language, "128-bit type is unstable");
1559+
"repr128",
1560+
sp,
1561+
GateIssue::Language,
1562+
"repr with 128-bit type is unstable");
15601563
}
15611564
}
15621565

src/libsyntax/feature_gate.rs

+3
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,9 @@ declare_features! (
312312
// The `i128` type
313313
(active, i128_type, "1.16.0", Some(35118)),
314314

315+
// The `repr(i128)` annotation for enums
316+
(active, repr128, "1.16.0", Some(35118)),
317+
315318
// The `unadjusted` ABI. Perma unstable.
316319
(active, abi_unadjusted, "1.16.0", None),
317320

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#[repr(u128)]
12+
enum A { //~ ERROR repr with 128-bit type is unstable
13+
//~| HELP: add #![feature(repr128)]
14+
A(u64)
15+
}
16+
17+
fn main() {}

0 commit comments

Comments
 (0)