rustc_feature/
removed.rs

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