Skip to content

Commit fb08c95

Browse files
committed
Remove or cfg out unused features in library
1 parent 511df3d commit fb08c95

5 files changed

Lines changed: 56 additions & 48 deletions

File tree

library/alloc/src/lib.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,12 @@
8585
//
8686
// Library features:
8787
// tidy-alphabetical-start
88-
#![cfg_attr(not(no_global_oom_handling), feature(string_replace_in_place))]
88+
#![cfg_attr(test, feature(assert_matches))]
8989
#![feature(allocator_api)]
9090
#![feature(array_into_iter_constructors)]
9191
#![feature(ascii_char)]
92-
#![feature(assert_matches)]
9392
#![feature(async_fn_traits)]
9493
#![feature(async_iterator)]
95-
#![feature(box_vec_non_null)]
9694
#![feature(bstr)]
9795
#![feature(bstr_internals)]
9896
#![feature(cast_maybe_uninit)]
@@ -149,7 +147,6 @@
149147
#![feature(slice_ptr_get)]
150148
#![feature(slice_range)]
151149
#![feature(std_internals)]
152-
#![feature(str_internals)]
153150
#![feature(temporary_niche_types)]
154151
#![feature(transmutability)]
155152
#![feature(trivial_clone)]
@@ -159,7 +156,6 @@
159156
#![feature(try_blocks)]
160157
#![feature(try_trait_v2)]
161158
#![feature(try_trait_v2_residual)]
162-
#![feature(try_with_capacity)]
163159
#![feature(tuple_trait)]
164160
#![feature(ub_checks)]
165161
#![feature(unicode_internals)]
@@ -177,10 +173,8 @@
177173
#![feature(const_trait_impl)]
178174
#![feature(coroutine_trait)]
179175
#![feature(decl_macro)]
180-
#![feature(derive_const)]
181176
#![feature(dropck_eyepatch)]
182177
#![feature(fundamental)]
183-
#![feature(hashmap_internals)]
184178
#![feature(intrinsics)]
185179
#![feature(lang_items)]
186180
#![feature(min_specialization)]
@@ -206,7 +200,7 @@
206200
// blocks is for `&[T]`, which also has documentation using this feature in `core`, and gets mad
207201
// that the feature-gate isn't enabled. Ideally, it wouldn't check for the feature gate for docs
208202
// from other crates, but since this can only appear for lang items, it doesn't seem worth fixing.
209-
#![feature(intra_doc_pointers)]
203+
#![cfg_attr(doc, feature(intra_doc_pointers))]
210204

211205
// Module with internal macros used by other modules (needs to be included before other modules).
212206
#[macro_use]

library/core/src/lib.rs

Lines changed: 41 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,25 @@
9595
//
9696
// Library features:
9797
// tidy-alphabetical-start
98-
#![feature(array_ptr_get)]
99-
#![feature(asm_experimental_arch)]
100-
#![feature(bstr)]
98+
#![cfg_attr(doc, feature(intra_doc_pointers))]
99+
#![cfg_attr(
100+
not(any(
101+
target_arch = "x86",
102+
target_arch = "x86_64",
103+
target_arch = "arm",
104+
target_arch = "aarch64",
105+
target_arch = "arm64ec",
106+
target_arch = "riscv32",
107+
target_arch = "riscv64",
108+
target_arch = "loongarch32",
109+
target_arch = "loongarch64",
110+
target_arch = "s390x",
111+
target_arch = "powerpc",
112+
target_arch = "powerpc64"
113+
)),
114+
feature(asm_experimental_arch)
115+
)]
116+
#![cfg_attr(windows, feature(link_cfg))]
101117
#![feature(bstr_internals)]
102118
#![feature(cfg_select)]
103119
#![feature(cfg_target_has_reliable_f16_f128)]
@@ -106,31 +122,14 @@
106122
#![feature(const_destruct)]
107123
#![feature(const_eval_select)]
108124
#![feature(const_select_unpredictable)]
109-
#![feature(const_unsigned_bigint_helpers)]
110125
#![feature(core_intrinsics)]
111126
#![feature(coverage_attribute)]
112127
#![feature(disjoint_bitor)]
113128
#![feature(internal_impls_macro)]
114-
#![feature(ip)]
115-
#![feature(is_ascii_octdigit)]
116-
#![feature(link_cfg)]
117129
#![feature(offset_of_enum)]
118130
#![feature(panic_internals)]
119131
#![feature(pattern_type_macro)]
120-
#![feature(ptr_alignment_type)]
121-
#![feature(ptr_metadata)]
122-
#![feature(set_ptr_value)]
123-
#![feature(signed_bigint_helpers)]
124-
#![feature(slice_ptr_get)]
125-
#![feature(str_internals)]
126-
#![feature(str_split_inclusive_remainder)]
127-
#![feature(str_split_remainder)]
128-
#![feature(type_info)]
129132
#![feature(ub_checks)]
130-
#![feature(unsafe_pinned)]
131-
#![feature(utf16_extra)]
132-
#![feature(variant_count)]
133-
#![feature(widening_mul)]
134133
// tidy-alphabetical-end
135134
//
136135
// Language features:
@@ -159,7 +158,6 @@
159158
#![feature(fundamental)]
160159
#![feature(funnel_shifts)]
161160
#![feature(if_let_guard)]
162-
#![feature(intra_doc_pointers)]
163161
#![feature(intrinsics)]
164162
#![feature(lang_items)]
165163
#![feature(link_llvm_intrinsics)]
@@ -175,7 +173,6 @@
175173
#![feature(optimize_attribute)]
176174
#![feature(pattern_types)]
177175
#![feature(prelude_import)]
178-
#![feature(reborrow)]
179176
#![feature(repr_simd)]
180177
#![feature(rustc_allow_const_fn_unstable)]
181178
#![feature(rustc_attrs)]
@@ -195,19 +192,28 @@
195192
//
196193
// Target features:
197194
// tidy-alphabetical-start
198-
#![feature(aarch64_unstable_target_feature)]
199-
#![feature(arm_target_feature)]
200-
#![feature(avx10_target_feature)]
201-
#![feature(hexagon_target_feature)]
202-
#![feature(loongarch_target_feature)]
203-
#![feature(mips_target_feature)]
204-
#![feature(nvptx_target_feature)]
205-
#![feature(powerpc_target_feature)]
206-
#![feature(riscv_target_feature)]
207-
#![feature(rtm_target_feature)]
208-
#![feature(s390x_target_feature)]
209-
#![feature(wasm_target_feature)]
210-
#![feature(x86_amx_intrinsics)]
195+
#![cfg_attr(
196+
any(target_arch = "loongarch32", target_arch = "loongarch64"),
197+
feature(loongarch_target_feature)
198+
)]
199+
#![cfg_attr(any(target_arch = "mips", target_arch = "mips64"), feature(mips_target_feature))]
200+
#![cfg_attr(
201+
any(target_arch = "powerpc", target_arch = "powerpc64"),
202+
feature(powerpc_target_feature)
203+
)]
204+
#![cfg_attr(any(target_arch = "riscv32", target_arch = "riscv64"), feature(riscv_target_feature))]
205+
#![cfg_attr(any(target_arch = "x86", target_arch = "x86_64"), feature(avx10_target_feature))]
206+
#![cfg_attr(any(target_arch = "x86", target_arch = "x86_64"), feature(rtm_target_feature))]
207+
#![cfg_attr(any(target_arch = "x86", target_arch = "x86_64"), feature(x86_amx_intrinsics))]
208+
#![cfg_attr(
209+
any(target_family = "wasm", target_arch = "wasm32", target_arch = "wasm64"),
210+
feature(wasm_target_feature)
211+
)]
212+
#![cfg_attr(target_arch = "aarch64", feature(aarch64_unstable_target_feature))]
213+
#![cfg_attr(target_arch = "arm", feature(arm_target_feature))]
214+
#![cfg_attr(target_arch = "hexagon", feature(hexagon_target_feature))]
215+
#![cfg_attr(target_arch = "nvptx64", feature(nvptx_target_feature))]
216+
#![cfg_attr(target_arch = "s390x", feature(s390x_target_feature))]
211217
// tidy-alphabetical-end
212218

213219
// allow using `core::` in intra-doc links

library/panic_unwind/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
#![doc(issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/")]
1717
#![feature(cfg_emscripten_wasm_eh)]
1818
#![feature(cfg_select)]
19-
#![feature(core_intrinsics)]
20-
#![feature(lang_items)]
2119
#![feature(panic_unwind)]
2220
#![feature(staged_api)]
2321
#![feature(std_internals)]

library/test/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#![feature(staged_api)]
2525
#![feature(process_exitcode_internals)]
2626
#![feature(panic_can_unwind)]
27-
#![feature(test)]
27+
#![cfg_attr(test, feature(test))]
2828
#![feature(thread_spawn_hook)]
2929
#![allow(internal_features)]
3030
#![warn(rustdoc::unescaped_backticks)]

library/unwind/src/lib.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,19 @@
22
#![unstable(feature = "panic_unwind", issue = "32837")]
33
#![feature(cfg_emscripten_wasm_eh)]
44
#![feature(cfg_select)]
5-
#![feature(link_cfg)]
5+
#![cfg_attr(
6+
any(
7+
target_env = "musl",
8+
target_env = "ohos",
9+
target_os = "android",
10+
all(target_os = "linux", any(target_env = "gnu", target_env = "uclibc")),
11+
target_os = "redox",
12+
target_os = "freebsd",
13+
all(target_os = "windows", target_env = "gnu", target_abi = "llvm")
14+
),
15+
feature(link_cfg)
16+
)]
617
#![feature(staged_api)]
7-
#![cfg_attr(not(target_env = "msvc"), feature(libc))]
818
#![cfg_attr(
919
all(target_family = "wasm", any(not(target_os = "emscripten"), emscripten_wasm_eh)),
1020
feature(link_llvm_intrinsics, simd_wasm64)

0 commit comments

Comments
 (0)