Skip to content

Commit

Permalink
Clean up the std library's #![feature]s
Browse files Browse the repository at this point in the history
Signed-off-by: JmPotato <ghzpotato@gmail.com>
  • Loading branch information
JmPotato committed Mar 5, 2022
1 parent 69f11ff commit 9b952b7
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions library/std/src/lib.rs
Expand Up @@ -212,7 +212,6 @@
#![needs_panic_runtime]
// std may use features in a platform-specific way
#![allow(unused_features)]
#![feature(rustc_allow_const_fn_unstable)]
#![cfg_attr(test, feature(internal_output_capture, print_internals, update_panic_count))]
#![cfg_attr(
all(target_vendor = "fortanix", target_env = "sgx"),
Expand All @@ -222,22 +221,17 @@
// std is implemented with unstable features, many of which are internal
// compiler details that will never be stable
// NB: the following list is sorted to minimize merge conflicts.
#![feature(absolute_path)]
#![feature(alloc_error_handler)]
#![feature(alloc_layout_extra)]
#![feature(allocator_api)]
#![feature(allocator_internals)]
#![feature(allow_internal_unsafe)]
#![feature(allow_internal_unstable)]
#![feature(arbitrary_self_types)]
#![feature(array_error_internals)]
#![feature(assert_matches)]
#![feature(associated_type_bounds)]
#![feature(async_iterator)]
#![feature(atomic_mut_ptr)]
#![feature(auto_traits)]
#![feature(bench_black_box)]
#![feature(bool_to_option)]
#![feature(box_syntax)]
#![feature(c_unwind)]
#![feature(c_variadic)]
Expand All @@ -248,7 +242,6 @@
#![feature(char_internals)]
#![feature(concat_bytes)]
#![feature(concat_idents)]
#![feature(const_fn_floating_point_arithmetic)]
#![feature(const_fn_fn_ptr_basics)]
#![feature(const_fn_trait_bound)]
#![feature(const_format_args)]
Expand All @@ -257,10 +250,8 @@
#![feature(const_ipv4)]
#![feature(const_ipv6)]
#![feature(const_option)]
#![feature(const_mut_refs)]
#![feature(const_socketaddr)]
#![feature(const_trait_impl)]
#![feature(container_error_extra)]
#![feature(c_size_t)]
#![feature(core_ffi_c)]
#![feature(core_intrinsics)]
Expand All @@ -279,24 +270,17 @@
#![feature(exact_size_is_empty)]
#![feature(exhaustive_patterns)]
#![feature(extend_one)]
#![feature(fn_traits)]
#![feature(float_minimum_maximum)]
#![feature(format_args_nl)]
#![feature(gen_future)]
#![feature(generator_trait)]
#![feature(get_mut_unchecked)]
#![feature(hashmap_internals)]
#![feature(int_error_internals)]
#![feature(integer_atomics)]
#![feature(int_log)]
#![feature(into_future)]
#![feature(intra_doc_pointers)]
#![feature(lang_items)]
#![feature(linkage)]
#![feature(log_syntax)]
#![feature(map_try_insert)]
#![feature(maybe_uninit_slice)]
#![feature(maybe_uninit_uninit_array)]
#![feature(maybe_uninit_write_slice)]
#![feature(min_specialization)]
#![feature(mixed_integer_ops)]
Expand All @@ -316,19 +300,14 @@
#![feature(portable_simd)]
#![feature(prelude_import)]
#![feature(ptr_as_uninit)]
#![feature(ptr_internals)]
#![feature(raw_os_nonzero)]
#![feature(rustc_attrs)]
#![feature(rustc_private)]

This comment has been minimized.

Copy link
@krasimirgg

krasimirgg Mar 15, 2022

Contributor

With this removal of rustc_private we're hitting some errors while trying to build std in a non-standard way (we're using a build system not based on cargo that directly invokes rustc).

E.g., the first error is with

extern crate libc;

use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

In the rustc invocation used to build std, we pass the freshly builtliblibc-hash.rlib explicitly as --extern=libc=/path/to/liblibc-hash.rlib (so we don't fall back to the one shipped in sysroot).
Does it make sense to add rustc_private back, or alternatively do you have any suggestions how we can maybe adapt the rustc invocation to tell it to apply the rustc_private feature to this module?

This comment has been minimized.

Copy link
@JmPotato

JmPotato Mar 16, 2022

Author Contributor

Thanks for pointing this out! It actually is a rather unexpected result for me. I was only thinking about whether removing these features would affect the compilation of Rust itself. If this feature is necessary, I think we can add it back. Can you help open an issue so we can discuss it further with the Rust core team?

This comment has been minimized.

Copy link
@krasimirgg

krasimirgg Mar 16, 2022

Contributor

Thank you! Update: issue has been resolved.
Filed #94994.

#![feature(saturating_int_impl)]
#![feature(slice_concat_ext)]
#![feature(slice_internals)]
#![feature(slice_ptr_get)]
#![feature(slice_ptr_len)]
#![feature(staged_api)]
#![feature(std_internals)]
#![feature(stdsimd)]
#![feature(stmt_expr_attributes)]
#![feature(str_internals)]
#![feature(test)]
#![feature(thread_local)]
Expand All @@ -338,8 +317,6 @@
#![feature(trace_macros)]
#![feature(try_blocks)]
#![feature(try_reserve_kind)]
#![feature(unboxed_closures)]
#![feature(unwrap_infallible)]
#![feature(vec_into_raw_parts)]
// NB: the above list is sorted to minimize merge conflicts.
#![default_lib_allocator]
Expand Down

0 comments on commit 9b952b7

Please sign in to comment.