]> git.proxmox.com Git - rustc.git/blame - compiler/rustc_feature/src/accepted.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / compiler / rustc_feature / src / accepted.rs
CommitLineData
e1599b0c
XL
1//! List of the accepted feature gates.
2
1b1a35ee 3use super::{to_nonzero, Feature, State};
dfeec247 4use rustc_span::symbol::sym;
e1599b0c
XL
5
6macro_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,
1b1a35ee 17 issue: to_nonzero($issue),
e1599b0c 18 edition: None,
e1599b0c
XL
19 }
20 ),+
21 ];
22 }
23}
24
dfeec247 25#[rustfmt::skip]
e1599b0c
XL
26declare_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),
3c0e092e
XL
37 // !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!!
38 // Features are listed in alphabetical order. Tidy will fail if you don't keep it this way.
39 // !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!!
e1599b0c
XL
40
41 // -------------------------------------------------------------------------
42 // feature-group-end: for testing purposes
43 // -------------------------------------------------------------------------
44
45 // -------------------------------------------------------------------------
46 // feature-group-start: accepted features
47 // -------------------------------------------------------------------------
48
5e7ed085
FG
49 /// Allows `#[target_feature(...)]` on aarch64 platforms
50 (accepted, aarch64_target_feature, "1.61.0", Some(44839), None),
3c0e092e
XL
51 /// Allows the sysV64 ABI to be specified on all platforms
52 /// instead of just the platforms on which it is the C ABI.
53 (accepted, abi_sysv64, "1.24.0", Some(36167), None),
5e7ed085
FG
54 /// Allows using ADX intrinsics from `core::arch::{x86, x86_64}`.
55 (accepted, adx_target_feature, "1.61.0", Some(44839), None),
3c0e092e
XL
56 /// Allows the definition of associated constants in `trait` or `impl` blocks.
57 (accepted, associated_consts, "1.20.0", Some(29646), None),
e1599b0c
XL
58 /// Allows using associated `type`s in `trait`s.
59 (accepted, associated_types, "1.0.0", None, None),
3c0e092e
XL
60 /// Allows free and inherent `async fn`s, `async` blocks, and `<expr>.await` expressions.
61 (accepted, async_await, "1.39.0", Some(50547), None),
62 /// Allows all literals in attribute lists and values of key-value pairs.
63 (accepted, attr_literals, "1.30.0", Some(34981), None),
e1599b0c
XL
64 /// Allows overloading augmented assignment operations like `a += b`.
65 (accepted, augmented_assignments, "1.8.0", Some(28235), None),
3c0e092e
XL
66 /// Allows mixing bind-by-move in patterns and references to those identifiers in guards.
67 (accepted, bind_by_move_pattern_guards, "1.39.0", Some(15287), None),
68 /// Allows bindings in the subpattern of a binding pattern.
69 /// For example, you can write `x @ Some(y)`.
70 (accepted, bindings_after_at, "1.56.0", Some(65490), None),
e1599b0c
XL
71 /// Allows empty structs and enum variants with braces.
72 (accepted, braced_empty_structs, "1.8.0", Some(29720), None),
3c0e092e
XL
73 /// Allows `#[cfg_attr(predicate, multiple, attributes, here)]`.
74 (accepted, cfg_attr_multi, "1.33.0", Some(54881), None),
75 /// Allows the use of `#[cfg(doctest)]`, set when rustdoc is collecting doctests.
76 (accepted, cfg_doctest, "1.40.0", Some(62210), None),
5099ac24
FG
77 /// Enables `#[cfg(panic = "...")]` config key.
78 (accepted, cfg_panic, "1.60.0", Some(77443), None),
3c0e092e
XL
79 /// Allows `cfg(target_feature = "...")`.
80 (accepted, cfg_target_feature, "1.27.0", Some(29717), None),
81 /// Allows `cfg(target_vendor = "...")`.
82 (accepted, cfg_target_vendor, "1.33.0", Some(29718), None),
83 /// Allows implementing `Clone` for closures where possible (RFC 2132).
84 (accepted, clone_closures, "1.26.0", Some(44490), None),
e1599b0c
XL
85 /// Allows coercing non capturing closures to function pointers.
86 (accepted, closure_to_fn_coercion, "1.19.0", Some(39817), None),
e1599b0c
XL
87 /// Allows usage of the `compile_error!` macro.
88 (accepted, compile_error, "1.20.0", Some(40872), None),
3c0e092e
XL
89 /// Allows `impl Trait` in function return types.
90 (accepted, conservative_impl_trait, "1.26.0", Some(34511), None),
91 /// Allows calling constructor functions in `const fn`.
92 (accepted, const_constructor, "1.40.0", Some(61456), None),
5e7ed085
FG
93 /// Allows using and casting function pointers in a `const fn`.
94 (accepted, const_fn_fn_ptr_basics, "1.61.0", Some(57563), None),
95 /// Allows trait bounds in `const fn`.
96 (accepted, const_fn_trait_bound, "1.61.0", Some(93706), None),
3c0e092e
XL
97 /// Allows calling `transmute` in const fn
98 (accepted, const_fn_transmute, "1.56.0", Some(53605), None),
99 /// Allows accessing fields of unions inside `const` functions.
100 (accepted, const_fn_union, "1.56.0", Some(51909), None),
101 /// Allows unsizing coercions in `const fn`.
102 (accepted, const_fn_unsize, "1.54.0", Some(64992), None),
a2a8927a
XL
103 /// Allows const generics to have default values (e.g. `struct Foo<const N: usize = 3>(...);`).
104 (accepted, const_generics_defaults, "1.59.0", Some(44580), None),
3c0e092e
XL
105 /// Allows the use of `if` and `match` in constants.
106 (accepted, const_if_match, "1.46.0", Some(49146), None),
5e7ed085
FG
107 /// Allows argument and return position `impl Trait` in a `const fn`.
108 (accepted, const_impl_trait, "1.61.0", Some(77463), None),
e1599b0c
XL
109 /// Allows indexing into constant arrays.
110 (accepted, const_indexing, "1.26.0", Some(29947), None),
3c0e092e
XL
111 /// Allows let bindings, assignments and destructuring in `const` functions and constants.
112 /// As long as control flow is not implemented in const eval, `&&` and `||` may not be used
113 /// at the same time as let bindings.
114 (accepted, const_let, "1.33.0", Some(48821), None),
115 /// Allows the use of `loop` and `while` in constants.
116 (accepted, const_loop, "1.46.0", Some(52000), None),
117 /// Allows panicking during const eval (producing compile-time errors).
118 (accepted, const_panic, "1.57.0", Some(51999), None),
119 /// Allows dereferencing raw pointers during const eval.
120 (accepted, const_raw_ptr_deref, "1.58.0", Some(51911), None),
e1599b0c
XL
121 /// Allows implementing `Copy` for closures where possible (RFC 2132).
122 (accepted, copy_closures, "1.26.0", Some(44490), None),
e1599b0c
XL
123 /// Allows `crate` in paths.
124 (accepted, crate_in_paths, "1.30.0", Some(45477), None),
3c0e092e
XL
125 /// Allows using assigning a default type to type parameters in algebraic data type definitions.
126 (accepted, default_type_params, "1.0.0", None, None),
127 /// Allows `#[deprecated]` attribute.
128 (accepted, deprecated, "1.9.0", Some(29935), None),
04454e1e
FG
129 /// Allows `#[derive(Default)]` and `#[default]` on enums.
130 (accepted, derive_default_enum, "1.62.0", Some(86985), None),
a2a8927a
XL
131 /// Allows the use of destructuring assignments.
132 (accepted, destructuring_assignment, "1.59.0", Some(71126), None),
3c0e092e
XL
133 /// Allows `#[doc(alias = "...")]`.
134 (accepted, doc_alias, "1.48.0", Some(50146), None),
135 /// Allows `..` in tuple (struct) patterns.
136 (accepted, dotdot_in_tuple_patterns, "1.14.0", Some(33627), None),
137 /// Allows `..=` in patterns (RFC 1192).
138 (accepted, dotdoteq_in_patterns, "1.26.0", Some(28237), None),
139 /// Allows `Drop` types in constants (RFC 1440).
140 (accepted, drop_types_in_const, "1.22.0", Some(33156), None),
141 /// Allows using `dyn Trait` as a syntax for trait objects.
142 (accepted, dyn_trait, "1.27.0", Some(44662), None),
143 /// Allows integer match exhaustiveness checking (RFC 2591).
144 (accepted, exhaustive_integer_patterns, "1.33.0", Some(50907), None),
923072b8
FG
145 /// Allows explicit generic arguments specification with `impl Trait` present.
146 (accepted, explicit_generic_args_with_impl_trait, "1.63.0", Some(83701), None),
3c0e092e
XL
147 /// Allows arbitrary expressions in key-value attributes at parse time.
148 (accepted, extended_key_value_attributes, "1.54.0", Some(78835), None),
e1599b0c
XL
149 /// Allows resolving absolute paths as paths from other crates.
150 (accepted, extern_absolute_paths, "1.30.0", Some(44660), None),
3c0e092e
XL
151 /// Allows `extern crate foo as bar;`. This puts `bar` into extern prelude.
152 (accepted, extern_crate_item_prelude, "1.31.0", Some(55599), None),
153 /// Allows `extern crate self as foo;`.
154 /// This puts local crate root into extern prelude under name `foo`.
155 (accepted, extern_crate_self, "1.34.0", Some(56409), None),
e1599b0c
XL
156 /// Allows access to crate names passed via `--extern` through prelude.
157 (accepted, extern_prelude, "1.30.0", Some(44660), None),
3c0e092e
XL
158 /// Allows field shorthands (`x` meaning `x: x`) in struct literal expressions.
159 (accepted, field_init_shorthand, "1.17.0", Some(37340), None),
160 /// Allows `#[must_use]` on functions, and introduces must-use operators (RFC 1940).
161 (accepted, fn_must_use, "1.27.0", Some(43302), None),
162 /// Allows capturing variables in scope using format_args!
163 (accepted, format_args_capture, "1.58.0", Some(67984), None),
164 /// Allows attributes on lifetime/type formal parameters in generics (RFC 1327).
165 (accepted, generic_param_attrs, "1.27.0", Some(48848), None),
166 /// Allows the `#[global_allocator]` attribute.
167 (accepted, global_allocator, "1.28.0", Some(27389), None),
168 // FIXME: explain `globs`.
169 (accepted, globs, "1.0.0", None, None),
170 /// Allows using the `u128` and `i128` types.
171 (accepted, i128_type, "1.26.0", Some(35118), None),
172 /// Allows the use of `if let` expressions.
173 (accepted, if_let, "1.0.0", None, None),
174 /// Allows top level or-patterns (`p | q`) in `if let` and `while let`.
175 (accepted, if_while_or_patterns, "1.33.0", Some(48215), None),
e1599b0c
XL
176 /// Allows lifetime elision in `impl` headers. For example:
177 /// + `impl<I:Iterator> Iterator for &mut Iterator`
178 /// + `impl Debug for Foo<'_>`
179 (accepted, impl_header_lifetime_elision, "1.31.0", Some(15872), None),
3c0e092e
XL
180 /// Allows using `a..=b` and `..=b` as inclusive range syntaxes.
181 (accepted, inclusive_range_syntax, "1.26.0", Some(28237), None),
182 /// Allows inferring outlives requirements (RFC 2093).
183 (accepted, infer_outlives_requirements, "1.30.0", Some(44493), None),
e1599b0c
XL
184 /// Allows irrefutable patterns in `if let` and `while let` statements (RFC 2086).
185 (accepted, irrefutable_let_patterns, "1.33.0", Some(44495), None),
3c0e092e
XL
186 /// Allows some increased flexibility in the name resolution rules,
187 /// especially around globs and shadowing (RFC 1560).
188 (accepted, item_like_imports, "1.15.0", Some(35120), None),
189 /// Allows `break {expr}` with a value inside `loop`s.
190 (accepted, loop_break_value, "1.19.0", Some(37339), None),
191 /// Allows use of `?` as the Kleene "at most one" operator in macros.
192 (accepted, macro_at_most_once_rep, "1.32.0", Some(48075), None),
193 /// Allows macro attributes to observe output of `#[derive]`.
194 (accepted, macro_attributes_in_derive_output, "1.57.0", Some(81119), None),
195 /// Allows use of the `:lifetime` macro fragment specifier.
196 (accepted, macro_lifetime_matcher, "1.27.0", Some(34303), None),
197 /// Allows use of the `:literal` macro fragment specifier (RFC 1576).
198 (accepted, macro_literal_matcher, "1.32.0", Some(35625), None),
199 /// Allows `macro_rules!` items.
200 (accepted, macro_rules, "1.0.0", None, None),
201 /// Allows use of the `:vis` macro fragment specifier
202 (accepted, macro_vis_matcher, "1.30.0", Some(41022), None),
e74abb32
XL
203 /// Allows macro invocations in `extern {}` blocks.
204 (accepted, macros_in_extern, "1.40.0", Some(49476), None),
3c0e092e
XL
205 /// Allows '|' at beginning of match arms (RFC 1925).
206 (accepted, match_beginning_vert, "1.25.0", Some(44101), None),
207 /// Allows default match binding modes (RFC 2005).
208 (accepted, match_default_bindings, "1.26.0", Some(42640), None),
209 /// Allows `impl Trait` with multiple unrelated lifetimes.
210 (accepted, member_constraints, "1.54.0", Some(61997), None),
211 /// Allows the definition of `const fn` functions.
212 (accepted, min_const_fn, "1.31.0", Some(53555), None),
213 /// The smallest useful subset of const generics.
214 (accepted, min_const_generics, "1.51.0", Some(74878), None),
215 /// Allows calling `const unsafe fn` inside `unsafe` blocks in `const fn` functions.
216 (accepted, min_const_unsafe_fn, "1.33.0", Some(55607), None),
217 /// Allows using `Self` and associated types in struct expressions and patterns.
218 (accepted, more_struct_aliases, "1.16.0", Some(37544), None),
219 /// Allows patterns with concurrent by-move and by-ref bindings.
220 /// For example, you can write `Foo(a, ref b)` where `a` is by-move and `b` is by-ref.
221 (accepted, move_ref_pattern, "1.49.0", Some(68354), None),
5e7ed085
FG
222 /// Allows specifying modifiers in the link attribute: `#[link(modifiers = "...")]`
223 (accepted, native_link_modifiers, "1.61.0", Some(81490), None),
923072b8
FG
224 /// Allows specifying the bundle link modifier
225 (accepted, native_link_modifiers_bundle, "1.63.0", Some(81490), None),
5e7ed085
FG
226 /// Allows specifying the whole-archive link modifier
227 (accepted, native_link_modifiers_whole_archive, "1.61.0", Some(81490), None),
923072b8
FG
228 /// Allows using non lexical lifetimes (RFC 2094).
229 (accepted, nll, "1.63.0", Some(43234), None),
3c0e092e
XL
230 /// Allows using `#![no_std]`.
231 (accepted, no_std, "1.6.0", None, None),
232 /// Allows defining identifiers beyond ASCII.
233 (accepted, non_ascii_idents, "1.53.0", Some(55467), None),
e74abb32
XL
234 /// Allows future-proofing enums/structs with the `#[non_exhaustive]` attribute (RFC 2008).
235 (accepted, non_exhaustive, "1.40.0", Some(44109), None),
3c0e092e
XL
236 /// Allows `foo.rs` as an alternative to `foo/mod.rs`.
237 (accepted, non_modrs_mods, "1.30.0", Some(44660), None),
238 /// Allows the use of or-patterns (e.g., `0 | 1`).
239 (accepted, or_patterns, "1.53.0", Some(54883), None),
240 /// Allows annotating functions conforming to `fn(&PanicInfo) -> !` with `#[panic_handler]`.
241 /// This defines the behavior of panics.
242 (accepted, panic_handler, "1.30.0", Some(44489), None),
243 /// Allows attributes in formal function parameters.
244 (accepted, param_attrs, "1.39.0", Some(60406), None),
245 /// Allows parentheses in patterns.
246 (accepted, pattern_parentheses, "1.31.0", Some(51087), None),
247 /// Allows procedural macros in `proc-macro` crates.
248 (accepted, proc_macro, "1.29.0", Some(38356), None),
249 /// Allows multi-segment paths in attributes and derives.
250 (accepted, proc_macro_path_invoc, "1.30.0", Some(38356), None),
251 /// Allows `pub(restricted)` visibilities (RFC 1422).
252 (accepted, pub_restricted, "1.18.0", Some(32409), None),
253 /// Allows use of the postfix `?` operator in expressions.
254 (accepted, question_mark, "1.13.0", Some(31436), None),
255 /// Allows keywords to be escaped for use as identifiers.
256 (accepted, raw_identifiers, "1.30.0", Some(48589), None),
60c5eb7d
XL
257 /// Allows relaxing the coherence rules such that
258 /// `impl<T> ForeignTrait<LocalType> for ForeignType<T>` is permitted.
259 (accepted, re_rebalance_coherence, "1.41.0", Some(55437), None),
3c0e092e
XL
260 /// Allows numeric fields in struct expressions and patterns.
261 (accepted, relaxed_adts, "1.19.0", Some(35626), None),
262 /// Lessens the requirements for structs to implement `Unsize`.
263 (accepted, relaxed_struct_unsize, "1.58.0", Some(81793), None),
264 /// Allows `repr(align(16))` struct attribute (RFC 1358).
265 (accepted, repr_align, "1.25.0", Some(33626), None),
266 /// Allows using `#[repr(align(X))]` on enums with equivalent semantics
267 /// to wrapping an enum in a wrapper struct with `#[repr(align(X))]`.
268 (accepted, repr_align_enum, "1.37.0", Some(57996), None),
269 /// Allows `#[repr(packed(N))]` attribute on structs.
270 (accepted, repr_packed, "1.33.0", Some(33158), None),
271 /// Allows `#[repr(transparent)]` attribute on newtype structs.
272 (accepted, repr_transparent, "1.28.0", Some(43036), None),
273 /// Allows code like `let x: &'static u32 = &42` to work (RFC 1414).
274 (accepted, rvalue_static_promotion, "1.21.0", Some(38865), None),
275 /// Allows `Self` in type definitions (RFC 2300).
276 (accepted, self_in_typedefs, "1.32.0", Some(49303), None),
277 /// Allows `Self` struct constructor (RFC 2302).
278 (accepted, self_struct_ctor, "1.32.0", Some(51994), None),
dfeec247
XL
279 /// Allows using subslice patterns, `[a, .., b]` and `[a, xs @ .., b]`.
280 (accepted, slice_patterns, "1.42.0", Some(62254), None),
3c0e092e
XL
281 /// Allows use of `&foo[a..b]` as a slicing syntax.
282 (accepted, slicing_syntax, "1.0.0", None, None),
283 /// Allows elision of `'static` lifetimes in `static`s and `const`s.
284 (accepted, static_in_const, "1.17.0", Some(35897), None),
285 /// Allows the definition recursive static items.
286 (accepted, static_recursion, "1.17.0", Some(29719), None),
287 /// Allows attributes on struct literal fields.
288 (accepted, struct_field_attributes, "1.20.0", Some(38814), None),
289 /// Allows struct variants `Foo { baz: u8, .. }` in enums (RFC 418).
290 (accepted, struct_variant, "1.0.0", None, None),
291 /// Allows `#[target_feature(...)]`.
292 (accepted, target_feature, "1.27.0", None, None),
293 /// Allows `fn main()` with return types which implements `Termination` (RFC 1937).
294 (accepted, termination_trait, "1.26.0", Some(43301), None),
295 /// Allows `#[test]` functions where the return type implements `Termination` (RFC 1937).
296 (accepted, termination_trait_test, "1.27.0", Some(48854), None),
297 /// Allows attributes scoped to tools.
298 (accepted, tool_attributes, "1.30.0", Some(44690), None),
299 /// Allows scoped lints.
300 (accepted, tool_lints, "1.31.0", Some(44690), None),
f035d41b
XL
301 /// Allows `#[track_caller]` to be used which provides
302 /// accurate caller location reporting during panic (RFC 2091).
303 (accepted, track_caller, "1.46.0", Some(47809), None),
3c0e092e
XL
304 /// Allows #[repr(transparent)] on univariant enums (RFC 2645).
305 (accepted, transparent_enums, "1.42.0", Some(60405), None),
306 /// Allows indexing tuples.
307 (accepted, tuple_indexing, "1.0.0", None, None),
308 /// Allows paths to enum variants on type aliases including `Self`.
309 (accepted, type_alias_enum_variants, "1.37.0", Some(49683), None),
310 /// Allows macros to appear in the type position.
311 (accepted, type_macros, "1.13.0", Some(27245), None),
312 /// Allows `const _: TYPE = VALUE`.
313 (accepted, underscore_const_names, "1.37.0", Some(54912), None),
314 /// Allows `use path as _;` and `extern crate c as _;`.
315 (accepted, underscore_imports, "1.33.0", Some(48216), None),
316 /// Allows `'_` placeholder lifetimes.
317 (accepted, underscore_lifetimes, "1.26.0", Some(44524), None),
318 /// Allows `use x::y;` to search `x` in the current scope.
319 (accepted, uniform_paths, "1.32.0", Some(53130), None),
320 /// Allows `impl Trait` in function arguments.
321 (accepted, universal_impl_trait, "1.26.0", Some(34511), None),
322 /// Allows arbitrary delimited token streams in non-macro attributes.
323 (accepted, unrestricted_attribute_tokens, "1.34.0", Some(55208), None),
6a06907d 324 /// The `unsafe_op_in_unsafe_fn` lint (allowed by default): no longer treat an unsafe function as an unsafe block.
cdc7bbd5 325 (accepted, unsafe_block_in_unsafe_fn, "1.52.0", Some(71668), None),
3c0e092e
XL
326 /// Allows importing and reexporting macros with `use`,
327 /// enables macro modularization in general.
328 (accepted, use_extern_macros, "1.30.0", Some(35896), None),
329 /// Allows nested groups in `use` items (RFC 2128).
330 (accepted, use_nested_groups, "1.25.0", Some(44494), None),
331 /// Allows `#[used]` to preserve symbols (see llvm.compiler.used).
332 (accepted, used, "1.30.0", Some(40289), None),
333 /// Allows the use of `while let` expressions.
334 (accepted, while_let, "1.0.0", None, None),
335 /// Allows `#![windows_subsystem]`.
336 (accepted, windows_subsystem, "1.18.0", Some(37499), None),
337 // !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!!
338 // Features are listed in alphabetical order. Tidy will fail if you don't keep it this way.
339 // !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!!
e1599b0c
XL
340
341 // -------------------------------------------------------------------------
342 // feature-group-end: accepted features
343 // -------------------------------------------------------------------------
344);