rustc_feature/
removed.rs

1//! List of the removed feature gates.
2
3use std::num::{NonZero, NonZeroU32};
4
5use rustc_span::sym;
6
7use super::{Feature, to_nonzero};
8
9pub struct RemovedFeature {
10    pub feature: Feature,
11    pub reason: Option<&'static str>,
12    pub pull: Option<NonZero<u32>>,
13}
14
15macro_rules! opt_nonzero_u32 {
16    () => {
17        None
18    };
19    ($val:expr) => {
20        Some(NonZeroU32::new($val).unwrap())
21    };
22}
23
24macro_rules! declare_features {
25    ($(
26        $(#[doc = $doc:tt])* (removed, $feature:ident, $ver:expr, $issue:expr, $reason:expr $(, $pull:expr)?),
27    )+) => {
28        /// Formerly unstable features that have now been removed.
29        pub static REMOVED_LANG_FEATURES: &[RemovedFeature] = &[
30            $(RemovedFeature {
31                feature: Feature {
32                    name: sym::$feature,
33                    since: $ver,
34                    issue: to_nonzero($issue),
35                },
36                reason: $reason,
37                pull:  opt_nonzero_u32!($($pull)?),
38            }),+
39        ];
40    };
41}
42
43#[rustfmt::skip]
44declare_features! (
45    // -------------------------------------------------------------------------
46    // feature-group-start: removed features
47    // -------------------------------------------------------------------------
48
49    // Note that the version indicates when it got *removed*.
50    // When moving an unstable feature here, set the version number to
51    // `CURRENT RUSTC VERSION` with ` ` replaced by `_`.
52    // (But not all features below do this properly; many indicate the
53    // version they got originally added in.)
54
55    /// Allows using the `amdgpu-kernel` ABI.
56    (removed, abi_amdgpu_kernel, "1.77.0", Some(51575), None, 120495),
57    (removed, abi_c_cmse_nonsecure_call, "CURRENT_RUSTC_VERSION", Some(81391), Some("renamed to abi_cmse_nonsecure_call"), 142146),
58    (removed, advanced_slice_patterns, "1.42.0", Some(62254),
59     Some("merged into `#![feature(slice_patterns)]`"), 67712),
60    (removed, allocator, "1.0.0", None, None),
61    /// Allows a test to fail without failing the whole suite.
62    (removed, allow_fail, "1.60.0", Some(46488), Some("removed due to no clear use cases"), 93416),
63    (removed, await_macro, "1.38.0", Some(50547),
64     Some("subsumed by `.await` syntax"), 62293),
65    /// Allows using the `box $expr` syntax.
66    (removed, box_syntax, "1.70.0", Some(49733), Some("replaced with `#[rustc_box]`"), 108471),
67    /// Allows capturing disjoint fields in a closure/coroutine (RFC 2229).
68    (removed, capture_disjoint_fields, "1.69.0", Some(53488), Some("stabilized in Rust 2021"), 108550),
69    /// Allows comparing raw pointers during const eval.
70    (removed, const_compare_raw_pointers, "1.46.0", Some(53020),
71     Some("cannot be allowed in const eval in any meaningful way"), 73398),
72    /// Allows limiting the evaluation steps of const expressions
73    (removed, const_eval_limit, "1.72.0", Some(67217), Some("removed the limit entirely"), 103877),
74    /// Allows non-trivial generic constants which have to be manually propagated upwards.
75    (removed, const_evaluatable_checked, "1.56.0", Some(76560), Some("renamed to `generic_const_exprs`"), 88369),
76    /// Allows the definition of `const` functions with some advanced features.
77    (removed, const_fn, "1.54.0", Some(57563),
78     Some("split into finer-grained feature gates"), 85109),
79    /// Allows const generic types (e.g. `struct Foo<const N: usize>(...);`).
80    (removed, const_generics, "1.56.0", Some(44580),
81     Some("removed in favor of `#![feature(adt_const_params)]` and `#![feature(generic_const_exprs)]`"), 88369),
82    /// Allows `[x; N]` where `x` is a constant (RFC 2203).
83    (removed, const_in_array_repeat_expressions,  "1.51.0", Some(49147),
84     Some("removed due to causing promotable bugs"), 80404),
85    /// Allows casting raw pointers to `usize` during const eval.
86    (removed, const_raw_ptr_to_usize_cast, "1.55.0", Some(51910),
87     Some("at compile-time, pointers do not have an integer value, so these casts cannot be properly supported"), 87020),
88    /// Allows `T: ?const Trait` syntax in bounds.
89    (removed, const_trait_bound_opt_out, "1.56.0", Some(67794),
90     Some("Removed in favor of `[const]` bound in #![feature(const_trait_impl)]"), 88328),
91    /// Allows using `crate` as visibility modifier, synonymous with `pub(crate)`.
92    (removed, crate_visibility_modifier, "1.63.0", Some(53120), Some("removed in favor of `pub(crate)`"), 97254),
93    /// Allows using custom attributes (RFC 572).
94    (removed, custom_attribute, "1.0.0", Some(29642),
95     Some("removed in favor of `#![register_tool]` and `#![register_attr]`"), 66070),
96    /// Allows the use of `#[derive(Anything)]` as sugar for `#[derive_Anything]`.
97    (removed, custom_derive, "1.32.0", Some(29644),
98     Some("subsumed by `#[proc_macro_derive]`")),
99    /// Allows default type parameters to influence type inference.
100    (removed, default_type_parameter_fallback, "1.82.0", Some(27336),
101     Some("never properly implemented; requires significant design work"), 127655),
102    /// Allows deriving traits as per `SmartPointer` specification
103    (removed, derive_smart_pointer, "1.84.0", Some(123430), Some("replaced by `CoercePointee`"), 131284),
104    /// Allows using `#[doc(keyword = "...")]`.
105    (removed, doc_keyword, "1.58.0", Some(51315),
106     Some("merged into `#![feature(rustdoc_internals)]`"), 90420),
107    /// Allows using `doc(primitive)` without a future-incompat warning.
108    (removed, doc_primitive, "1.58.0", Some(88070),
109     Some("merged into `#![feature(rustdoc_internals)]`"), 90420),
110    /// Allows `#[doc(spotlight)]`.
111    /// The attribute was renamed to `#[doc(notable_trait)]`
112    /// and the feature to `doc_notable_trait`.
113    (removed, doc_spotlight, "1.53.0", Some(45040),
114     Some("renamed to `doc_notable_trait`"), 80965),
115    /// Allows using `#[unsafe_destructor_blind_to_params]` (RFC 1238).
116    (removed, dropck_parametricity, "1.38.0", Some(28498), None),
117    /// Allows making `dyn Trait` well-formed even if `Trait` is not dyn compatible[^1].
118    /// In that case, `dyn Trait: Trait` does not hold. Moreover, coercions and
119    /// casts in safe Rust to `dyn Trait` for such a `Trait` is also forbidden.
120    ///
121    /// Renamed from `object_safe_for_dispatch`.
122    ///
123    /// [^1]: Formerly known as "object safe".
124    (removed, dyn_compatible_for_dispatch, "1.87.0", Some(43561),
125     Some("removed, not used heavily and represented additional complexity in dyn compatibility"), 136522),
126    /// Allows `dyn* Trait` objects.
127    (removed, dyn_star, "1.65.0", Some(102425),
128     Some("removed as it was no longer necessary for AFIDT (async fn in dyn trait) support")),
129    /// Uses generic effect parameters for [const] bounds
130    (removed, effects, "1.84.0", Some(102090),
131     Some("removed, redundant with `#![feature(const_trait_impl)]`"), 132479),
132    /// Allows defining `existential type`s.
133    (removed, existential_type, "1.38.0", Some(63063),
134     Some("removed in favor of `#![feature(type_alias_impl_trait)]`")),
135    /// Paths of the form: `extern::foo::bar`
136    (removed, extern_in_paths, "1.33.0", Some(55600),
137     Some("subsumed by `::foo::bar` paths"), 57572),
138    /// Allows `#[doc(include = "some-file")]`.
139    (removed, external_doc, "1.54.0", Some(44732),
140     Some("use #[doc = include_str!(\"filename\")] instead, which handles macro invocations"), 85457),
141    /// Allows using `#[ffi_returns_twice]` on foreign functions.
142    (removed, ffi_returns_twice, "1.78.0", Some(58314),
143     Some("being investigated by the ffi-unwind project group"), 120502),
144    /// Allows generators to be cloned.
145    (removed, generator_clone, "1.75.0", Some(95360), Some("renamed to `coroutine_clone`"), 116958),
146    /// Allows defining generators.
147    (removed, generators, "1.75.0", Some(43122), Some("renamed to `coroutines`"), 116958),
148    /// An extension to the `generic_associated_types` feature, allowing incomplete features.
149    (removed, generic_associated_types_extended, "1.85.0", Some(95451),
150        Some(
151            "feature needs overhaul and reimplementation pending \
152            better implied higher-ranked implied bounds support"
153        ),
154        133768
155    ),
156    (removed, import_shadowing, "1.0.0", None, None),
157    /// Allows in-band quantification of lifetime bindings (e.g., `fn foo(x: &'a u8) -> &'a u8`).
158    (removed, in_band_lifetimes, "1.61.0", Some(44524),
159     Some("removed due to unsolved ergonomic questions and added lifetime resolution complexity"), 93845),
160    /// Allows inferring `'static` outlives requirements (RFC 2093).
161    (removed, infer_static_outlives_requirements, "1.63.0", Some(54185),
162     Some("removed as it caused some confusion and discussion was inactive for years"), 97875),
163    /// Allow anonymous constants from an inline `const` block in pattern position
164    (removed, inline_const_pat, "1.88.0", Some(76001),
165     Some("removed due to implementation concerns as it requires significant refactorings"), 138492),
166    /// Lazily evaluate constants. This allows constants to depend on type parameters.
167    (removed, lazy_normalization_consts, "1.56.0", Some(72219), Some("superseded by `generic_const_exprs`"), 88369),
168    /// Changes `impl Trait` to capture all lifetimes in scope.
169    (removed, lifetime_capture_rules_2024, "1.87.0", None, Some("unnecessary -- use edition 2024 instead"), 136787),
170    /// Allows using the `#[link_args]` attribute.
171    (removed, link_args, "1.53.0", Some(29596),
172     Some("removed in favor of using `-C link-arg=ARG` on command line, \
173           which is available from cargo build scripts with `cargo:rustc-link-arg` now"), 83820),
174    (removed, macro_reexport, "1.0.0", Some(29638),
175     Some("subsumed by `pub use`"), 49982),
176    /// Allows using `#[main]` to replace the entrypoint `#[lang = "start"]` calls.
177    (removed, main, "1.53.0", Some(29634), None, 84217),
178    (removed, managed_boxes, "1.0.0", None, None),
179    /// Allows the use of type alias impl trait in function return positions
180    (removed, min_type_alias_impl_trait, "1.56.0", Some(63063),
181     Some("removed in favor of full type_alias_impl_trait"), 87564),
182    /// Make `mut` not reset the binding mode on edition >= 2024.
183    (removed, mut_preserve_binding_mode_2024, "1.80.0", Some(123076), Some("superseded by `ref_pat_eat_one_layer_2024`"), 125168),
184    (removed, needs_allocator, "1.4.0", Some(27389),
185     Some("subsumed by `#![feature(allocator_internals)]`")),
186    /// Allows use of unary negate on unsigned integers, e.g., -e for e: u8
187    (removed, negate_unsigned, "1.0.0", Some(29645), None),
188    /// Allows `#[no_coverage]` on functions.
189    /// The feature was renamed to `coverage_attribute` and the attribute to `#[coverage(on|off)]`
190    (removed, no_coverage, "1.74.0", Some(84605), Some("renamed to `coverage_attribute`"), 114656),
191    /// Allows `#[no_debug]`.
192    (removed, no_debug, "1.43.0", Some(29721), Some("removed due to lack of demand"), 69667),
193    /// Note: this feature was previously recorded in a separate
194    /// `STABLE_REMOVED` list because it, uniquely, was once stable but was
195    /// then removed. But there was no utility storing it separately, so now
196    /// it's in this list.
197    (removed, no_stack_check, "1.0.0", None, None, 40110),
198    /// Allows making `dyn Trait` well-formed even if `Trait` is not dyn compatible (object safe).
199    /// Renamed to `dyn_compatible_for_dispatch`.
200    (removed, object_safe_for_dispatch, "1.83.0", Some(43561),
201     Some("renamed to `dyn_compatible_for_dispatch`"), 131511),
202    /// Allows using `#[on_unimplemented(..)]` on traits.
203    /// (Moved to `rustc_attrs`.)
204    (removed, on_unimplemented, "1.40.0", None, None, 65794),
205    /// A way to temporarily opt out of opt-in copy. This will *never* be accepted.
206    (removed, opt_out_copy, "1.0.0", None, None, 20740),
207    /// Allows features specific to OIBIT (now called auto traits).
208    /// Renamed to `auto_traits`.
209    (removed, optin_builtin_traits, "1.50.0", Some(13231),
210     Some("renamed to `auto_traits`"), 79336),
211    /// Allows overlapping impls of marker traits.
212    (removed, overlapping_marker_traits, "1.42.0", Some(29864),
213     Some("removed in favor of `#![feature(marker_trait_attr)]`"), 68544),
214    (removed, panic_implementation, "1.28.0", Some(44489),
215     Some("subsumed by `#[panic_handler]`"), 53619),
216    /// Allows `extern "platform-intrinsic" { ... }`.
217    (removed, platform_intrinsics, "1.78.0", Some(27731),
218     Some("SIMD intrinsics use the regular intrinsics ABI now"), 121516),
219    /// Allows using `#![plugin(myplugin)]`.
220    (removed, plugin, "1.75.0", Some(29597),
221     Some("plugins are no longer supported"), 116412),
222    /// Allows using `#[plugin_registrar]` on functions.
223    (removed, plugin_registrar, "1.75.0", Some(29597),
224     Some("plugins are no longer supported"), 116412),
225    /// Allows exhaustive integer pattern matching with `usize::MAX`/`isize::MIN`/`isize::MAX`.
226    (removed, precise_pointer_size_matching, "1.76.0", Some(56354),
227     Some("removed in favor of half-open ranges"), 118598),
228    (removed, pref_align_of, "1.89.0", Some(91971),
229     Some("removed due to marginal use and inducing compiler complications")),
230    (removed, proc_macro_expr, "1.27.0", Some(54727),
231     Some("subsumed by `#![feature(proc_macro_hygiene)]`"), 52121),
232    (removed, proc_macro_gen, "1.27.0", Some(54727),
233     Some("subsumed by `#![feature(proc_macro_hygiene)]`"), 52121),
234    (removed, proc_macro_mod, "1.27.0", Some(54727),
235     Some("subsumed by `#![feature(proc_macro_hygiene)]`"), 52121),
236    (removed, proc_macro_non_items, "1.27.0", Some(54727),
237     Some("subsumed by `#![feature(proc_macro_hygiene)]`"), 52121),
238    (removed, pub_macro_rules, "1.53.0", Some(78855),
239     Some("removed due to being incomplete, in particular it does not work across crates")),
240    (removed, pushpop_unsafe, "1.2.0", None, None),
241    (removed, quad_precision_float, "1.0.0", None, None),
242    (removed, quote, "1.33.0", Some(29601), None),
243    (removed, ref_pat_everywhere, "1.80.0", Some(123076), Some("superseded by `ref_pat_eat_one_layer_2024"), 125168),
244    (removed, reflect, "1.0.0", Some(27749), None),
245    /// Allows using the `#[register_attr]` attribute.
246    (removed, register_attr, "1.65.0", Some(66080),
247     Some("removed in favor of `#![register_tool]`"), 66070),
248    (removed, rust_2018_preview, "1.76.0", None,
249     Some("2018 Edition preview is no longer relevant")),
250    /// Allows using the macros:
251    /// + `__diagnostic_used`
252    /// + `__register_diagnostic`
253    /// +`__build_diagnostic_array`
254    (removed, rustc_diagnostic_macros, "1.38.0", None, None, 64139),
255    /// Allows identifying crates that contain sanitizer runtimes.
256    (removed, sanitizer_runtime, "1.17.0", None, None, 65241),
257    (removed, simd, "1.0.0", Some(27731), Some("removed in favor of `#[repr(simd)]`")),
258    /// Allows using `#[start]` on a function indicating that it is the program entrypoint.
259    (removed, start, "1.86.0", Some(29633), Some("not portable enough and never RFC'd"), 134299),
260    /// Allows `#[link(kind = "static-nobundle", ...)]`.
261    (removed, static_nobundle, "1.63.0", Some(37403),
262     Some(r#"subsumed by `#[link(kind = "static", modifiers = "-bundle", ...)]`"#), 95818),
263    (removed, struct_inherit, "1.0.0", None, None),
264    (removed, test_removed_feature, "1.0.0", None, None),
265    /// Allows using items which are missing stability attributes
266    (removed, unmarked_api, "1.0.0", None, None),
267    /// Allows unnamed fields of struct and union type
268    (removed, unnamed_fields, "1.83.0", Some(49804), Some("feature needs redesign"), 131045),
269    (removed, unsafe_no_drop_flag, "1.0.0", None, None),
270    /// Allows unsized rvalues at arguments and parameters.
271    (removed, unsized_locals, "1.89.0", Some(48055), Some("removed due to implementation concerns; see https://github.com/rust-lang/rust/issues/111942")),
272    (removed, unsized_tuple_coercion, "1.87.0", Some(42877),
273     Some("The feature restricts possible layouts for tuples, and this restriction is not worth it."), 137728),
274    /// Allows `union` fields that don't implement `Copy` as long as they don't have any drop glue.
275    (removed, untagged_unions, "1.64.0", Some(55149),
276     Some("unions with `Copy` and `ManuallyDrop` fields are stable; there is no intent to stabilize more"), 97995),
277    /// Allows `#[unwind(..)]`.
278    ///
279    /// Permits specifying whether a function should permit unwinding or abort on unwind.
280    (removed, unwind_attributes, "1.56.0", Some(58760), Some("use the C-unwind ABI instead"), 86155),
281    (removed, visible_private_types, "1.0.0", None, None),
282    /// Allows `extern "wasm" fn`
283    (removed, wasm_abi, "1.81.0", Some(83788),
284     Some("non-standard wasm ABI is no longer supported"), 127605),
285    // !!!!    !!!!    !!!!    !!!!   !!!!    !!!!    !!!!    !!!!    !!!!    !!!!    !!!!
286    // Features are listed in alphabetical order. Tidy will fail if you don't keep it this way.
287    // !!!!    !!!!    !!!!    !!!!   !!!!    !!!!    !!!!    !!!!    !!!!    !!!!    !!!!
288
289    // -------------------------------------------------------------------------
290    // feature-group-end: removed features
291    // -------------------------------------------------------------------------
292
293
294    // -------------------------------------------------------------------------
295    // feature-group-start: removed library features
296    // -------------------------------------------------------------------------
297    //
298    // FIXME(#141617): we should have a better way to track removed library features, but we reuse
299    // the infrastructure here so users still get hints. The symbols used here can be remove from
300    // `symbol.rs` when that happens.
301    (removed, concat_idents, "CURRENT_RUSTC_VERSION", Some(29599),
302     Some("use the `${concat(..)}` metavariable expression instead"), 142704),
303    // -------------------------------------------------------------------------
304    // feature-group-end: removed library features
305    // -------------------------------------------------------------------------
306);