]> git.lizzy.rs Git - rust.git/blob - src/libsyntax/feature_gate/accepted.rs
Rollup merge of #65789 - Centril:with-desugared-doc, r=davidtwco
[rust.git] / src / libsyntax / feature_gate / accepted.rs
1 //! List of the accepted feature gates.
2
3 use crate::symbol::sym;
4 use super::{State, Feature};
5
6 macro_rules! declare_features {
7     ($(
8         $(#[doc = $doc:tt])* (accepted, $feature:ident, $ver:expr, $issue:expr, None),
9     )+) => {
10         /// Those language feature has since been Accepted (it was once Active)
11         pub const ACCEPTED_FEATURES: &[Feature] = &[
12             $(
13                 Feature {
14                     state: State::Accepted,
15                     name: sym::$feature,
16                     since: $ver,
17                     issue: $issue,
18                     edition: None,
19                     description: concat!($($doc,)*),
20                 }
21             ),+
22         ];
23     }
24 }
25
26 declare_features! (
27     // -------------------------------------------------------------------------
28     // feature-group-start: for testing purposes
29     // -------------------------------------------------------------------------
30
31     /// A temporary feature gate used to enable parser extensions needed
32     /// to bootstrap fix for #5723.
33     (accepted, issue_5723_bootstrap, "1.0.0", None, None),
34     /// These are used to test this portion of the compiler,
35     /// they don't actually mean anything.
36     (accepted, test_accepted_feature, "1.0.0", None, None),
37
38     // -------------------------------------------------------------------------
39     // feature-group-end: for testing purposes
40     // -------------------------------------------------------------------------
41
42     // -------------------------------------------------------------------------
43     // feature-group-start: accepted features
44     // -------------------------------------------------------------------------
45
46     /// Allows using associated `type`s in `trait`s.
47     (accepted, associated_types, "1.0.0", None, None),
48     /// Allows using assigning a default type to type parameters in algebraic data type definitions.
49     (accepted, default_type_params, "1.0.0", None, None),
50     // FIXME: explain `globs`.
51     (accepted, globs, "1.0.0", None, None),
52     /// Allows `macro_rules!` items.
53     (accepted, macro_rules, "1.0.0", None, None),
54     /// Allows use of `&foo[a..b]` as a slicing syntax.
55     (accepted, slicing_syntax, "1.0.0", None, None),
56     /// Allows struct variants `Foo { baz: u8, .. }` in enums (RFC 418).
57     (accepted, struct_variant, "1.0.0", None, None),
58     /// Allows indexing tuples.
59     (accepted, tuple_indexing, "1.0.0", None, None),
60     /// Allows the use of `if let` expressions.
61     (accepted, if_let, "1.0.0", None, None),
62     /// Allows the use of `while let` expressions.
63     (accepted, while_let, "1.0.0", None, None),
64     /// Allows using `#![no_std]`.
65     (accepted, no_std, "1.6.0", None, None),
66     /// Allows overloading augmented assignment operations like `a += b`.
67     (accepted, augmented_assignments, "1.8.0", Some(28235), None),
68     /// Allows empty structs and enum variants with braces.
69     (accepted, braced_empty_structs, "1.8.0", Some(29720), None),
70     /// Allows `#[deprecated]` attribute.
71     (accepted, deprecated, "1.9.0", Some(29935), None),
72     /// Allows macros to appear in the type position.
73     (accepted, type_macros, "1.13.0", Some(27245), None),
74     /// Allows use of the postfix `?` operator in expressions.
75     (accepted, question_mark, "1.13.0", Some(31436), None),
76     /// Allows `..` in tuple (struct) patterns.
77     (accepted, dotdot_in_tuple_patterns, "1.14.0", Some(33627), None),
78     /// Allows some increased flexibility in the name resolution rules,
79     /// especially around globs and shadowing (RFC 1560).
80     (accepted, item_like_imports, "1.15.0", Some(35120), None),
81     /// Allows using `Self` and associated types in struct expressions and patterns.
82     (accepted, more_struct_aliases, "1.16.0", Some(37544), None),
83     /// Allows elision of `'static` lifetimes in `static`s and `const`s.
84     (accepted, static_in_const, "1.17.0", Some(35897), None),
85     /// Allows field shorthands (`x` meaning `x: x`) in struct literal expressions.
86     (accepted, field_init_shorthand, "1.17.0", Some(37340), None),
87     /// Allows the definition recursive static items.
88     (accepted, static_recursion, "1.17.0", Some(29719), None),
89     /// Allows `pub(restricted)` visibilities (RFC 1422).
90     (accepted, pub_restricted, "1.18.0", Some(32409), None),
91     /// Allows `#![windows_subsystem]`.
92     (accepted, windows_subsystem, "1.18.0", Some(37499), None),
93     /// Allows `break {expr}` with a value inside `loop`s.
94     (accepted, loop_break_value, "1.19.0", Some(37339), None),
95     /// Allows numeric fields in struct expressions and patterns.
96     (accepted, relaxed_adts, "1.19.0", Some(35626), None),
97     /// Allows coercing non capturing closures to function pointers.
98     (accepted, closure_to_fn_coercion, "1.19.0", Some(39817), None),
99     /// Allows attributes on struct literal fields.
100     (accepted, struct_field_attributes, "1.20.0", Some(38814), None),
101     /// Allows the definition of associated constants in `trait` or `impl` blocks.
102     (accepted, associated_consts, "1.20.0", Some(29646), None),
103     /// Allows usage of the `compile_error!` macro.
104     (accepted, compile_error, "1.20.0", Some(40872), None),
105     /// Allows code like `let x: &'static u32 = &42` to work (RFC 1414).
106     (accepted, rvalue_static_promotion, "1.21.0", Some(38865), None),
107     /// Allows `Drop` types in constants (RFC 1440).
108     (accepted, drop_types_in_const, "1.22.0", Some(33156), None),
109     /// Allows the sysV64 ABI to be specified on all platforms
110     /// instead of just the platforms on which it is the C ABI.
111     (accepted, abi_sysv64, "1.24.0", Some(36167), None),
112     /// Allows `repr(align(16))` struct attribute (RFC 1358).
113     (accepted, repr_align, "1.25.0", Some(33626), None),
114     /// Allows '|' at beginning of match arms (RFC 1925).
115     (accepted, match_beginning_vert, "1.25.0", Some(44101), None),
116     /// Allows nested groups in `use` items (RFC 2128).
117     (accepted, use_nested_groups, "1.25.0", Some(44494), None),
118     /// Allows indexing into constant arrays.
119     (accepted, const_indexing, "1.26.0", Some(29947), None),
120     /// Allows using `a..=b` and `..=b` as inclusive range syntaxes.
121     (accepted, inclusive_range_syntax, "1.26.0", Some(28237), None),
122     /// Allows `..=` in patterns (RFC 1192).
123     (accepted, dotdoteq_in_patterns, "1.26.0", Some(28237), None),
124     /// Allows `fn main()` with return types which implements `Termination` (RFC 1937).
125     (accepted, termination_trait, "1.26.0", Some(43301), None),
126     /// Allows implementing `Clone` for closures where possible (RFC 2132).
127     (accepted, clone_closures, "1.26.0", Some(44490), None),
128     /// Allows implementing `Copy` for closures where possible (RFC 2132).
129     (accepted, copy_closures, "1.26.0", Some(44490), None),
130     /// Allows `impl Trait` in function arguments.
131     (accepted, universal_impl_trait, "1.26.0", Some(34511), None),
132     /// Allows `impl Trait` in function return types.
133     (accepted, conservative_impl_trait, "1.26.0", Some(34511), None),
134     /// Allows using the `u128` and `i128` types.
135     (accepted, i128_type, "1.26.0", Some(35118), None),
136     /// Allows default match binding modes (RFC 2005).
137     (accepted, match_default_bindings, "1.26.0", Some(42640), None),
138     /// Allows `'_` placeholder lifetimes.
139     (accepted, underscore_lifetimes, "1.26.0", Some(44524), None),
140     /// Allows attributes on lifetime/type formal parameters in generics (RFC 1327).
141     (accepted, generic_param_attrs, "1.27.0", Some(48848), None),
142     /// Allows `cfg(target_feature = "...")`.
143     (accepted, cfg_target_feature, "1.27.0", Some(29717), None),
144     /// Allows `#[target_feature(...)]`.
145     (accepted, target_feature, "1.27.0", None, None),
146     /// Allows using `dyn Trait` as a syntax for trait objects.
147     (accepted, dyn_trait, "1.27.0", Some(44662), None),
148     /// Allows `#[must_use]` on functions, and introduces must-use operators (RFC 1940).
149     (accepted, fn_must_use, "1.27.0", Some(43302), None),
150     /// Allows use of the `:lifetime` macro fragment specifier.
151     (accepted, macro_lifetime_matcher, "1.27.0", Some(34303), None),
152     /// Allows `#[test]` functions where the return type implements `Termination` (RFC 1937).
153     (accepted, termination_trait_test, "1.27.0", Some(48854), None),
154     /// Allows the `#[global_allocator]` attribute.
155     (accepted, global_allocator, "1.28.0", Some(27389), None),
156     /// Allows `#[repr(transparent)]` attribute on newtype structs.
157     (accepted, repr_transparent, "1.28.0", Some(43036), None),
158     /// Allows procedural macros in `proc-macro` crates.
159     (accepted, proc_macro, "1.29.0", Some(38356), None),
160     /// Allows `foo.rs` as an alternative to `foo/mod.rs`.
161     (accepted, non_modrs_mods, "1.30.0", Some(44660), None),
162     /// Allows use of the `:vis` macro fragment specifier
163     (accepted, macro_vis_matcher, "1.30.0", Some(41022), None),
164     /// Allows importing and reexporting macros with `use`,
165     /// enables macro modularization in general.
166     (accepted, use_extern_macros, "1.30.0", Some(35896), None),
167     /// Allows keywords to be escaped for use as identifiers.
168     (accepted, raw_identifiers, "1.30.0", Some(48589), None),
169     /// Allows attributes scoped to tools.
170     (accepted, tool_attributes, "1.30.0", Some(44690), None),
171     /// Allows multi-segment paths in attributes and derives.
172     (accepted, proc_macro_path_invoc, "1.30.0", Some(38356), None),
173     /// Allows all literals in attribute lists and values of key-value pairs.
174     (accepted, attr_literals, "1.30.0", Some(34981), None),
175     /// Allows inferring outlives requirements (RFC 2093).
176     (accepted, infer_outlives_requirements, "1.30.0", Some(44493), None),
177     /// Allows annotating functions conforming to `fn(&PanicInfo) -> !` with `#[panic_handler]`.
178     /// This defines the behavior of panics.
179     (accepted, panic_handler, "1.30.0", Some(44489), None),
180     /// Allows `#[used]` to preserve symbols (see llvm.used).
181     (accepted, used, "1.30.0", Some(40289), None),
182     /// Allows `crate` in paths.
183     (accepted, crate_in_paths, "1.30.0", Some(45477), None),
184     /// Allows resolving absolute paths as paths from other crates.
185     (accepted, extern_absolute_paths, "1.30.0", Some(44660), None),
186     /// Allows access to crate names passed via `--extern` through prelude.
187     (accepted, extern_prelude, "1.30.0", Some(44660), None),
188     /// Allows parentheses in patterns.
189     (accepted, pattern_parentheses, "1.31.0", Some(51087), None),
190     /// Allows the definition of `const fn` functions.
191     (accepted, min_const_fn, "1.31.0", Some(53555), None),
192     /// Allows scoped lints.
193     (accepted, tool_lints, "1.31.0", Some(44690), None),
194     /// Allows lifetime elision in `impl` headers. For example:
195     /// + `impl<I:Iterator> Iterator for &mut Iterator`
196     /// + `impl Debug for Foo<'_>`
197     (accepted, impl_header_lifetime_elision, "1.31.0", Some(15872), None),
198     /// Allows `extern crate foo as bar;`. This puts `bar` into extern prelude.
199     (accepted, extern_crate_item_prelude, "1.31.0", Some(55599), None),
200     /// Allows use of the `:literal` macro fragment specifier (RFC 1576).
201     (accepted, macro_literal_matcher, "1.32.0", Some(35625), None),
202     /// Allows use of `?` as the Kleene "at most one" operator in macros.
203     (accepted, macro_at_most_once_rep, "1.32.0", Some(48075), None),
204     /// Allows `Self` struct constructor (RFC 2302).
205     (accepted, self_struct_ctor, "1.32.0", Some(51994), None),
206     /// Allows `Self` in type definitions (RFC 2300).
207     (accepted, self_in_typedefs, "1.32.0", Some(49303), None),
208     /// Allows `use x::y;` to search `x` in the current scope.
209     (accepted, uniform_paths, "1.32.0", Some(53130), None),
210     /// Allows integer match exhaustiveness checking (RFC 2591).
211     (accepted, exhaustive_integer_patterns, "1.33.0", Some(50907), None),
212     /// Allows `use path as _;` and `extern crate c as _;`.
213     (accepted, underscore_imports, "1.33.0", Some(48216), None),
214     /// Allows `#[repr(packed(N))]` attribute on structs.
215     (accepted, repr_packed, "1.33.0", Some(33158), None),
216     /// Allows irrefutable patterns in `if let` and `while let` statements (RFC 2086).
217     (accepted, irrefutable_let_patterns, "1.33.0", Some(44495), None),
218     /// Allows calling `const unsafe fn` inside `unsafe` blocks in `const fn` functions.
219     (accepted, min_const_unsafe_fn, "1.33.0", Some(55607), None),
220     /// Allows let bindings, assignments and destructuring in `const` functions and constants.
221     /// As long as control flow is not implemented in const eval, `&&` and `||` may not be used
222     /// at the same time as let bindings.
223     (accepted, const_let, "1.33.0", Some(48821), None),
224     /// Allows `#[cfg_attr(predicate, multiple, attributes, here)]`.
225     (accepted, cfg_attr_multi, "1.33.0", Some(54881), None),
226     /// Allows top level or-patterns (`p | q`) in `if let` and `while let`.
227     (accepted, if_while_or_patterns, "1.33.0", Some(48215), None),
228     /// Allows `cfg(target_vendor = "...")`.
229     (accepted, cfg_target_vendor, "1.33.0", Some(29718), None),
230     /// Allows `extern crate self as foo;`.
231     /// This puts local crate root into extern prelude under name `foo`.
232     (accepted, extern_crate_self, "1.34.0", Some(56409), None),
233     /// Allows arbitrary delimited token streams in non-macro attributes.
234     (accepted, unrestricted_attribute_tokens, "1.34.0", Some(55208), None),
235     /// Allows paths to enum variants on type aliases including `Self`.
236     (accepted, type_alias_enum_variants, "1.37.0", Some(49683), None),
237     /// Allows using `#[repr(align(X))]` on enums with equivalent semantics
238     /// to wrapping an enum in a wrapper struct with `#[repr(align(X))]`.
239     (accepted, repr_align_enum, "1.37.0", Some(57996), None),
240     /// Allows `const _: TYPE = VALUE`.
241     (accepted, underscore_const_names, "1.37.0", Some(54912), None),
242     /// Allows free and inherent `async fn`s, `async` blocks, and `<expr>.await` expressions.
243     (accepted, async_await, "1.39.0", Some(50547), None),
244     /// Allows mixing bind-by-move in patterns and references to those identifiers in guards.
245     (accepted, bind_by_move_pattern_guards, "1.39.0", Some(15287), None),
246     /// Allows attributes in formal function parameters.
247     (accepted, param_attrs, "1.39.0", Some(60406), None),
248     /// Allows macro invocations in `extern {}` blocks.
249     (accepted, macros_in_extern, "1.40.0", Some(49476), None),
250     /// Allows future-proofing enums/structs with the `#[non_exhaustive]` attribute (RFC 2008).
251     (accepted, non_exhaustive, "1.40.0", Some(44109), None),
252
253     // -------------------------------------------------------------------------
254     // feature-group-end: accepted features
255     // -------------------------------------------------------------------------
256 );