Stabilize type_alias_enum_variants.

This commit is contained in:
Mazdak Farrokhzad 2019-05-31 15:46:08 +02:00
parent 9f06855064
commit ac94bbef55
5 changed files with 4 additions and 25 deletions

View file

@ -6,7 +6,7 @@
#![feature(label_break_value)]
#![feature(nll)]
#![feature(rustc_diagnostic_macros)]
#![feature(type_alias_enum_variants)]
#![cfg_attr(bootstrap, feature(type_alias_enum_variants))]
#![recursion_limit="256"]

View file

@ -34,7 +34,6 @@ use std::collections::BTreeSet;
use std::iter;
use std::slice;
use super::{check_type_alias_enum_variants_enabled};
use rustc_data_structures::fx::FxHashSet;
#[derive(Debug)]
@ -1599,7 +1598,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
});
if let Some(variant_def) = variant_def {
if permit_variants {
check_type_alias_enum_variants_enabled(tcx, span);
tcx.check_stability(variant_def.def_id, Some(hir_ref_id), span);
return Ok((qself_ty, DefKind::Variant, variant_def.def_id));
} else {

View file

@ -26,7 +26,6 @@ use rustc::infer::{self, InferOk};
use syntax::ast;
use syntax_pos::Span;
use crate::{check_type_alias_enum_variants_enabled};
use self::probe::{IsSuggestion, ProbeScope};
pub fn provide(providers: &mut ty::query::Providers<'_>) {
@ -417,8 +416,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
tcx.hygienic_eq(method_name, vd.ident, adt_def.did)
});
if let Some(variant_def) = variant_def {
check_type_alias_enum_variants_enabled(tcx, span);
// Braced variants generate unusable names in value namespace (reserved for
// possible future use), so variants resolved as associated items may refer to
// them as well. It's ok to use the variant's id as a ctor id since an

View file

@ -105,7 +105,7 @@ use rustc::lint;
use rustc::middle;
use rustc::session;
use rustc::util::common::ErrorReported;
use rustc::session::config::{EntryFnType, nightly_options};
use rustc::session::config::EntryFnType;
use rustc::traits::{ObligationCause, ObligationCauseCode, TraitEngine, TraitEngineExt};
use rustc::ty::subst::SubstsRef;
use rustc::ty::{self, Ty, TyCtxt};
@ -124,21 +124,6 @@ pub struct TypeAndSubsts<'tcx> {
ty: Ty<'tcx>,
}
fn check_type_alias_enum_variants_enabled<'tcx>(tcx: TyCtxt<'tcx>, span: Span) {
if !tcx.features().type_alias_enum_variants {
let mut err = tcx.sess.struct_span_err(
span,
"enum variants on type aliases are experimental"
);
if nightly_options::is_nightly_build() {
help!(&mut err,
"add `#![feature(type_alias_enum_variants)]` to the \
crate attributes to enable");
}
err.emit();
}
}
fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_>, decl: &hir::FnDecl, abi: Abi, span: Span) {
if decl.c_variadic && !(abi == Abi::C || abi == Abi::Cdecl) {
let mut err = struct_span_err!(tcx.sess, span, E0045,

View file

@ -532,9 +532,6 @@ declare_features! (
// Allows using `reason` in lint attributes and the `#[expect(lint)]` lint check.
(active, lint_reasons, "1.31.0", Some(54503), None),
// Allows paths to enum variants on type aliases.
(active, type_alias_enum_variants, "1.31.0", Some(49683), None),
// Allows exhaustive integer pattern matching on `usize` and `isize`.
(active, precise_pointer_size_matching, "1.32.0", Some(56354), None),
@ -849,6 +846,8 @@ declare_features! (
(accepted, extern_crate_self, "1.34.0", Some(56409), None),
// Allows arbitrary delimited token streams in non-macro attributes.
(accepted, unrestricted_attribute_tokens, "1.34.0", Some(55208), None),
// Allows paths to enum variants on type aliases including `Self`.
(accepted, type_alias_enum_variants, "1.37.0", Some(49683), None),
// Allows using `#[repr(align(X))]` on enums with equivalent semantics
// to wrapping an enum in a wrapper struct with `#[repr(align(X))]`.
(accepted, repr_align_enum, "1.37.0", Some(57996), None),