Skip to content

Commit ac94bbe

Browse files
committed
Stabilize type_alias_enum_variants.
1 parent 9f06855 commit ac94bbe

File tree

5 files changed

+4
-25
lines changed

5 files changed

+4
-25
lines changed

src/librustc_resolve/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#![feature(label_break_value)]
77
#![feature(nll)]
88
#![feature(rustc_diagnostic_macros)]
9-
#![feature(type_alias_enum_variants)]
9+
#![cfg_attr(bootstrap, feature(type_alias_enum_variants))]
1010

1111
#![recursion_limit="256"]
1212

src/librustc_typeck/astconv.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ use std::collections::BTreeSet;
3434
use std::iter;
3535
use std::slice;
3636

37-
use super::{check_type_alias_enum_variants_enabled};
3837
use rustc_data_structures::fx::FxHashSet;
3938

4039
#[derive(Debug)]
@@ -1599,7 +1598,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
15991598
});
16001599
if let Some(variant_def) = variant_def {
16011600
if permit_variants {
1602-
check_type_alias_enum_variants_enabled(tcx, span);
16031601
tcx.check_stability(variant_def.def_id, Some(hir_ref_id), span);
16041602
return Ok((qself_ty, DefKind::Variant, variant_def.def_id));
16051603
} else {

src/librustc_typeck/check/method/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use rustc::infer::{self, InferOk};
2626
use syntax::ast;
2727
use syntax_pos::Span;
2828

29-
use crate::{check_type_alias_enum_variants_enabled};
3029
use self::probe::{IsSuggestion, ProbeScope};
3130

3231
pub fn provide(providers: &mut ty::query::Providers<'_>) {
@@ -417,8 +416,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
417416
tcx.hygienic_eq(method_name, vd.ident, adt_def.did)
418417
});
419418
if let Some(variant_def) = variant_def {
420-
check_type_alias_enum_variants_enabled(tcx, span);
421-
422419
// Braced variants generate unusable names in value namespace (reserved for
423420
// possible future use), so variants resolved as associated items may refer to
424421
// them as well. It's ok to use the variant's id as a ctor id since an

src/librustc_typeck/lib.rs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ use rustc::lint;
105105
use rustc::middle;
106106
use rustc::session;
107107
use rustc::util::common::ErrorReported;
108-
use rustc::session::config::{EntryFnType, nightly_options};
108+
use rustc::session::config::EntryFnType;
109109
use rustc::traits::{ObligationCause, ObligationCauseCode, TraitEngine, TraitEngineExt};
110110
use rustc::ty::subst::SubstsRef;
111111
use rustc::ty::{self, Ty, TyCtxt};
@@ -124,21 +124,6 @@ pub struct TypeAndSubsts<'tcx> {
124124
ty: Ty<'tcx>,
125125
}
126126

127-
fn check_type_alias_enum_variants_enabled<'tcx>(tcx: TyCtxt<'tcx>, span: Span) {
128-
if !tcx.features().type_alias_enum_variants {
129-
let mut err = tcx.sess.struct_span_err(
130-
span,
131-
"enum variants on type aliases are experimental"
132-
);
133-
if nightly_options::is_nightly_build() {
134-
help!(&mut err,
135-
"add `#![feature(type_alias_enum_variants)]` to the \
136-
crate attributes to enable");
137-
}
138-
err.emit();
139-
}
140-
}
141-
142127
fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_>, decl: &hir::FnDecl, abi: Abi, span: Span) {
143128
if decl.c_variadic && !(abi == Abi::C || abi == Abi::Cdecl) {
144129
let mut err = struct_span_err!(tcx.sess, span, E0045,

src/libsyntax/feature_gate.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,9 +532,6 @@ declare_features! (
532532
// Allows using `reason` in lint attributes and the `#[expect(lint)]` lint check.
533533
(active, lint_reasons, "1.31.0", Some(54503), None),
534534

535-
// Allows paths to enum variants on type aliases.
536-
(active, type_alias_enum_variants, "1.31.0", Some(49683), None),
537-
538535
// Allows exhaustive integer pattern matching on `usize` and `isize`.
539536
(active, precise_pointer_size_matching, "1.32.0", Some(56354), None),
540537

@@ -849,6 +846,8 @@ declare_features! (
849846
(accepted, extern_crate_self, "1.34.0", Some(56409), None),
850847
// Allows arbitrary delimited token streams in non-macro attributes.
851848
(accepted, unrestricted_attribute_tokens, "1.34.0", Some(55208), None),
849+
// Allows paths to enum variants on type aliases including `Self`.
850+
(accepted, type_alias_enum_variants, "1.37.0", Some(49683), None),
852851
// Allows using `#[repr(align(X))]` on enums with equivalent semantics
853852
// to wrapping an enum in a wrapper struct with `#[repr(align(X))]`.
854853
(accepted, repr_align_enum, "1.37.0", Some(57996), None),

0 commit comments

Comments
 (0)