Skip to content

Commit b873743

Browse files
committed
syntax: extract accepted.rs feature gates.
1 parent 7602267 commit b873743

File tree

2 files changed

+239
-231
lines changed

2 files changed

+239
-231
lines changed

src/libsyntax/feature_gate.rs

Lines changed: 3 additions & 231 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
//! gate usage is added, *do not remove it again* even once the feature
1313
//! becomes stable.
1414
15+
mod accepted;
16+
use accepted::ACCEPTED_FEATURES;
17+
1518
use AttributeType::*;
1619
use AttributeGate::*;
1720

@@ -94,13 +97,6 @@ macro_rules! declare_features {
9497
$((sym::$feature, $ver, $issue, None)),+
9598
];
9699
};
97-
98-
($((accepted, $feature: ident, $ver: expr, $issue: expr, None),)+) => {
99-
/// Those language feature has since been Accepted (it was once Active)
100-
const ACCEPTED_FEATURES: &[(Symbol, &str, Option<u32>, Option<&str>)] = &[
101-
$((sym::$feature, $ver, $issue, None)),+
102-
];
103-
}
104100
}
105101

106102
// If you change this, please modify `src/doc/unstable-book` as well.
@@ -638,230 +634,6 @@ declare_features! (
638634
(stable_removed, no_stack_check, "1.0.0", None, None),
639635
);
640636

641-
declare_features! (
642-
// -------------------------------------------------------------------------
643-
// feature-group-start: for testing purposes
644-
// -------------------------------------------------------------------------
645-
646-
// A temporary feature gate used to enable parser extensions needed
647-
// to bootstrap fix for #5723.
648-
(accepted, issue_5723_bootstrap, "1.0.0", None, None),
649-
// These are used to test this portion of the compiler,
650-
// they don't actually mean anything.
651-
(accepted, test_accepted_feature, "1.0.0", None, None),
652-
653-
// -------------------------------------------------------------------------
654-
// feature-group-end: for testing purposes
655-
// -------------------------------------------------------------------------
656-
657-
// -------------------------------------------------------------------------
658-
// feature-group-start: accepted features
659-
// -------------------------------------------------------------------------
660-
661-
// Allows using associated `type`s in `trait`s.
662-
(accepted, associated_types, "1.0.0", None, None),
663-
// Allows using assigning a default type to type parameters in algebraic data type definitions.
664-
(accepted, default_type_params, "1.0.0", None, None),
665-
// FIXME: explain `globs`.
666-
(accepted, globs, "1.0.0", None, None),
667-
// Allows `macro_rules!` items.
668-
(accepted, macro_rules, "1.0.0", None, None),
669-
// Allows use of `&foo[a..b]` as a slicing syntax.
670-
(accepted, slicing_syntax, "1.0.0", None, None),
671-
// Allows struct variants `Foo { baz: u8, .. }` in enums (RFC 418).
672-
(accepted, struct_variant, "1.0.0", None, None),
673-
// Allows indexing tuples.
674-
(accepted, tuple_indexing, "1.0.0", None, None),
675-
// Allows the use of `if let` expressions.
676-
(accepted, if_let, "1.0.0", None, None),
677-
// Allows the use of `while let` expressions.
678-
(accepted, while_let, "1.0.0", None, None),
679-
// Allows using `#![no_std]`.
680-
(accepted, no_std, "1.6.0", None, None),
681-
// Allows overloading augmented assignment operations like `a += b`.
682-
(accepted, augmented_assignments, "1.8.0", Some(28235), None),
683-
// Allows empty structs and enum variants with braces.
684-
(accepted, braced_empty_structs, "1.8.0", Some(29720), None),
685-
// Allows `#[deprecated]` attribute.
686-
(accepted, deprecated, "1.9.0", Some(29935), None),
687-
// Allows macros to appear in the type position.
688-
(accepted, type_macros, "1.13.0", Some(27245), None),
689-
// Allows use of the postfix `?` operator in expressions.
690-
(accepted, question_mark, "1.13.0", Some(31436), None),
691-
// Allows `..` in tuple (struct) patterns.
692-
(accepted, dotdot_in_tuple_patterns, "1.14.0", Some(33627), None),
693-
// Allows some increased flexibility in the name resolution rules,
694-
// especially around globs and shadowing (RFC 1560).
695-
(accepted, item_like_imports, "1.15.0", Some(35120), None),
696-
// Allows using `Self` and associated types in struct expressions and patterns.
697-
(accepted, more_struct_aliases, "1.16.0", Some(37544), None),
698-
// Allows elision of `'static` lifetimes in `static`s and `const`s.
699-
(accepted, static_in_const, "1.17.0", Some(35897), None),
700-
// Allows field shorthands (`x` meaning `x: x`) in struct literal expressions.
701-
(accepted, field_init_shorthand, "1.17.0", Some(37340), None),
702-
// Allows the definition recursive static items.
703-
(accepted, static_recursion, "1.17.0", Some(29719), None),
704-
// Allows `pub(restricted)` visibilities (RFC 1422).
705-
(accepted, pub_restricted, "1.18.0", Some(32409), None),
706-
// Allows `#![windows_subsystem]`.
707-
(accepted, windows_subsystem, "1.18.0", Some(37499), None),
708-
// Allows `break {expr}` with a value inside `loop`s.
709-
(accepted, loop_break_value, "1.19.0", Some(37339), None),
710-
// Allows numeric fields in struct expressions and patterns.
711-
(accepted, relaxed_adts, "1.19.0", Some(35626), None),
712-
// Allows coercing non capturing closures to function pointers.
713-
(accepted, closure_to_fn_coercion, "1.19.0", Some(39817), None),
714-
// Allows attributes on struct literal fields.
715-
(accepted, struct_field_attributes, "1.20.0", Some(38814), None),
716-
// Allows the definition of associated constants in `trait` or `impl` blocks.
717-
(accepted, associated_consts, "1.20.0", Some(29646), None),
718-
// Allows usage of the `compile_error!` macro.
719-
(accepted, compile_error, "1.20.0", Some(40872), None),
720-
// Allows code like `let x: &'static u32 = &42` to work (RFC 1414).
721-
(accepted, rvalue_static_promotion, "1.21.0", Some(38865), None),
722-
// Allows `Drop` types in constants (RFC 1440).
723-
(accepted, drop_types_in_const, "1.22.0", Some(33156), None),
724-
// Allows the sysV64 ABI to be specified on all platforms
725-
// instead of just the platforms on which it is the C ABI.
726-
(accepted, abi_sysv64, "1.24.0", Some(36167), None),
727-
// Allows `repr(align(16))` struct attribute (RFC 1358).
728-
(accepted, repr_align, "1.25.0", Some(33626), None),
729-
// Allows '|' at beginning of match arms (RFC 1925).
730-
(accepted, match_beginning_vert, "1.25.0", Some(44101), None),
731-
// Allows nested groups in `use` items (RFC 2128).
732-
(accepted, use_nested_groups, "1.25.0", Some(44494), None),
733-
// Allows indexing into constant arrays.
734-
(accepted, const_indexing, "1.26.0", Some(29947), None),
735-
// Allows using `a..=b` and `..=b` as inclusive range syntaxes.
736-
(accepted, inclusive_range_syntax, "1.26.0", Some(28237), None),
737-
// Allows `..=` in patterns (RFC 1192).
738-
(accepted, dotdoteq_in_patterns, "1.26.0", Some(28237), None),
739-
// Allows `fn main()` with return types which implements `Termination` (RFC 1937).
740-
(accepted, termination_trait, "1.26.0", Some(43301), None),
741-
// Allows implementing `Clone` for closures where possible (RFC 2132).
742-
(accepted, clone_closures, "1.26.0", Some(44490), None),
743-
// Allows implementing `Copy` for closures where possible (RFC 2132).
744-
(accepted, copy_closures, "1.26.0", Some(44490), None),
745-
// Allows `impl Trait` in function arguments.
746-
(accepted, universal_impl_trait, "1.26.0", Some(34511), None),
747-
// Allows `impl Trait` in function return types.
748-
(accepted, conservative_impl_trait, "1.26.0", Some(34511), None),
749-
// Allows using the `u128` and `i128` types.
750-
(accepted, i128_type, "1.26.0", Some(35118), None),
751-
// Allows default match binding modes (RFC 2005).
752-
(accepted, match_default_bindings, "1.26.0", Some(42640), None),
753-
// Allows `'_` placeholder lifetimes.
754-
(accepted, underscore_lifetimes, "1.26.0", Some(44524), None),
755-
// Allows attributes on lifetime/type formal parameters in generics (RFC 1327).
756-
(accepted, generic_param_attrs, "1.27.0", Some(48848), None),
757-
// Allows `cfg(target_feature = "...")`.
758-
(accepted, cfg_target_feature, "1.27.0", Some(29717), None),
759-
// Allows `#[target_feature(...)]`.
760-
(accepted, target_feature, "1.27.0", None, None),
761-
// Allows using `dyn Trait` as a syntax for trait objects.
762-
(accepted, dyn_trait, "1.27.0", Some(44662), None),
763-
// Allows `#[must_use]` on functions, and introduces must-use operators (RFC 1940).
764-
(accepted, fn_must_use, "1.27.0", Some(43302), None),
765-
// Allows use of the `:lifetime` macro fragment specifier.
766-
(accepted, macro_lifetime_matcher, "1.27.0", Some(34303), None),
767-
// Allows `#[test]` functions where the return type implements `Termination` (RFC 1937).
768-
(accepted, termination_trait_test, "1.27.0", Some(48854), None),
769-
// Allows the `#[global_allocator]` attribute.
770-
(accepted, global_allocator, "1.28.0", Some(27389), None),
771-
// Allows `#[repr(transparent)]` attribute on newtype structs.
772-
(accepted, repr_transparent, "1.28.0", Some(43036), None),
773-
// Allows procedural macros in `proc-macro` crates.
774-
(accepted, proc_macro, "1.29.0", Some(38356), None),
775-
// Allows `foo.rs` as an alternative to `foo/mod.rs`.
776-
(accepted, non_modrs_mods, "1.30.0", Some(44660), None),
777-
// Allows use of the `:vis` macro fragment specifier
778-
(accepted, macro_vis_matcher, "1.30.0", Some(41022), None),
779-
// Allows importing and reexporting macros with `use`,
780-
// enables macro modularization in general.
781-
(accepted, use_extern_macros, "1.30.0", Some(35896), None),
782-
// Allows keywords to be escaped for use as identifiers.
783-
(accepted, raw_identifiers, "1.30.0", Some(48589), None),
784-
// Allows attributes scoped to tools.
785-
(accepted, tool_attributes, "1.30.0", Some(44690), None),
786-
// Allows multi-segment paths in attributes and derives.
787-
(accepted, proc_macro_path_invoc, "1.30.0", Some(38356), None),
788-
// Allows all literals in attribute lists and values of key-value pairs.
789-
(accepted, attr_literals, "1.30.0", Some(34981), None),
790-
// Allows inferring outlives requirements (RFC 2093).
791-
(accepted, infer_outlives_requirements, "1.30.0", Some(44493), None),
792-
// Allows annotating functions conforming to `fn(&PanicInfo) -> !` with `#[panic_handler]`.
793-
// This defines the behavior of panics.
794-
(accepted, panic_handler, "1.30.0", Some(44489), None),
795-
// Allows `#[used]` to preserve symbols (see llvm.used).
796-
(accepted, used, "1.30.0", Some(40289), None),
797-
// Allows `crate` in paths.
798-
(accepted, crate_in_paths, "1.30.0", Some(45477), None),
799-
// Allows resolving absolute paths as paths from other crates.
800-
(accepted, extern_absolute_paths, "1.30.0", Some(44660), None),
801-
// Allows access to crate names passed via `--extern` through prelude.
802-
(accepted, extern_prelude, "1.30.0", Some(44660), None),
803-
// Allows parentheses in patterns.
804-
(accepted, pattern_parentheses, "1.31.0", Some(51087), None),
805-
// Allows the definition of `const fn` functions.
806-
(accepted, min_const_fn, "1.31.0", Some(53555), None),
807-
// Allows scoped lints.
808-
(accepted, tool_lints, "1.31.0", Some(44690), None),
809-
// Allows lifetime elision in `impl` headers. For example:
810-
// + `impl<I:Iterator> Iterator for &mut Iterator`
811-
// + `impl Debug for Foo<'_>`
812-
(accepted, impl_header_lifetime_elision, "1.31.0", Some(15872), None),
813-
// Allows `extern crate foo as bar;`. This puts `bar` into extern prelude.
814-
(accepted, extern_crate_item_prelude, "1.31.0", Some(55599), None),
815-
// Allows use of the `:literal` macro fragment specifier (RFC 1576).
816-
(accepted, macro_literal_matcher, "1.32.0", Some(35625), None),
817-
// Allows use of `?` as the Kleene "at most one" operator in macros.
818-
(accepted, macro_at_most_once_rep, "1.32.0", Some(48075), None),
819-
// Allows `Self` struct constructor (RFC 2302).
820-
(accepted, self_struct_ctor, "1.32.0", Some(51994), None),
821-
// Allows `Self` in type definitions (RFC 2300).
822-
(accepted, self_in_typedefs, "1.32.0", Some(49303), None),
823-
// Allows `use x::y;` to search `x` in the current scope.
824-
(accepted, uniform_paths, "1.32.0", Some(53130), None),
825-
// Allows integer match exhaustiveness checking (RFC 2591).
826-
(accepted, exhaustive_integer_patterns, "1.33.0", Some(50907), None),
827-
// Allows `use path as _;` and `extern crate c as _;`.
828-
(accepted, underscore_imports, "1.33.0", Some(48216), None),
829-
// Allows `#[repr(packed(N))]` attribute on structs.
830-
(accepted, repr_packed, "1.33.0", Some(33158), None),
831-
// Allows irrefutable patterns in `if let` and `while let` statements (RFC 2086).
832-
(accepted, irrefutable_let_patterns, "1.33.0", Some(44495), None),
833-
// Allows calling `const unsafe fn` inside `unsafe` blocks in `const fn` functions.
834-
(accepted, min_const_unsafe_fn, "1.33.0", Some(55607), None),
835-
// Allows let bindings, assignments and destructuring in `const` functions and constants.
836-
// As long as control flow is not implemented in const eval, `&&` and `||` may not be used
837-
// at the same time as let bindings.
838-
(accepted, const_let, "1.33.0", Some(48821), None),
839-
// Allows `#[cfg_attr(predicate, multiple, attributes, here)]`.
840-
(accepted, cfg_attr_multi, "1.33.0", Some(54881), None),
841-
// Allows top level or-patterns (`p | q`) in `if let` and `while let`.
842-
(accepted, if_while_or_patterns, "1.33.0", Some(48215), None),
843-
// Allows `cfg(target_vendor = "...")`.
844-
(accepted, cfg_target_vendor, "1.33.0", Some(29718), None),
845-
// Allows `extern crate self as foo;`.
846-
// This puts local crate root into extern prelude under name `foo`.
847-
(accepted, extern_crate_self, "1.34.0", Some(56409), None),
848-
// Allows arbitrary delimited token streams in non-macro attributes.
849-
(accepted, unrestricted_attribute_tokens, "1.34.0", Some(55208), None),
850-
// Allows paths to enum variants on type aliases including `Self`.
851-
(accepted, type_alias_enum_variants, "1.37.0", Some(49683), None),
852-
// Allows using `#[repr(align(X))]` on enums with equivalent semantics
853-
// to wrapping an enum in a wrapper struct with `#[repr(align(X))]`.
854-
(accepted, repr_align_enum, "1.37.0", Some(57996), None),
855-
// Allows `const _: TYPE = VALUE`.
856-
(accepted, underscore_const_names, "1.37.0", Some(54912), None),
857-
// Allows free and inherent `async fn`s, `async` blocks, and `<expr>.await` expressions.
858-
(accepted, async_await, "1.39.0", Some(50547), None),
859-
860-
// -------------------------------------------------------------------------
861-
// feature-group-end: accepted features
862-
// -------------------------------------------------------------------------
863-
);
864-
865637
// If you change this, please modify `src/doc/unstable-book` as well. You must
866638
// move that documentation into the relevant place in the other docs, and
867639
// remove the chapter on the flag.

0 commit comments

Comments
 (0)