mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-26 13:01:27 +03:00
Remove or allow unused features in library doc and tests
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
// tidy-alphabetical-start
|
||||
#![feature(allocator_api)]
|
||||
#![feature(array_into_iter_constructors)]
|
||||
#![feature(box_vec_non_null)]
|
||||
#![feature(char_internals)]
|
||||
#![feature(const_alloc_error)]
|
||||
#![feature(const_cmp)]
|
||||
@@ -55,16 +54,12 @@
|
||||
//
|
||||
// Language features:
|
||||
// tidy-alphabetical-start
|
||||
#![feature(cfg_sanitize)]
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(dropck_eyepatch)]
|
||||
#![feature(lang_items)]
|
||||
#![feature(min_specialization)]
|
||||
#![feature(negative_impls)]
|
||||
#![feature(never_type)]
|
||||
#![feature(optimize_attribute)]
|
||||
#![feature(prelude_import)]
|
||||
#![feature(rustc_allow_const_fn_unstable)]
|
||||
#![feature(rustc_attrs)]
|
||||
#![feature(staged_api)]
|
||||
#![feature(test)]
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#![feature(const_heap)]
|
||||
#![feature(deque_extend_front)]
|
||||
#![feature(iter_array_chunks)]
|
||||
#![feature(wtf8_internals)]
|
||||
#![feature(cow_is_borrowed)]
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(downcast_unchecked)]
|
||||
@@ -30,8 +29,6 @@
|
||||
#![feature(string_remove_matches)]
|
||||
#![feature(const_btree_len)]
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(panic_update_hook)]
|
||||
#![feature(pointer_is_aligned_to)]
|
||||
#![feature(test)]
|
||||
#![feature(thin_box)]
|
||||
#![feature(drain_keep_rest)]
|
||||
|
||||
@@ -878,7 +878,7 @@ pub const fn is_digit(self) -> bool {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(ascii_char, ascii_char_variants, is_ascii_octdigit)]
|
||||
/// #![feature(ascii_char, ascii_char_variants)]
|
||||
///
|
||||
/// use std::ascii;
|
||||
///
|
||||
|
||||
@@ -774,7 +774,6 @@ pub const fn as_slice_of_cells(&self) -> &[Cell<T>] {
|
||||
/// following is unsound:
|
||||
///
|
||||
/// ```rust
|
||||
/// #![feature(cell_get_cloned)]
|
||||
/// # use std::cell::Cell;
|
||||
///
|
||||
/// #[derive(Copy, Debug)]
|
||||
|
||||
@@ -219,6 +219,7 @@ fn from(small: bool) -> Self {
|
||||
f16;
|
||||
doctest_prefix:
|
||||
// rustdoc doesn't remove the conventional space after the `///`
|
||||
///# #![allow(unused_features)]
|
||||
///#![feature(f16)]
|
||||
///# #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
|
||||
///
|
||||
@@ -230,6 +231,7 @@ fn from(small: bool) -> Self {
|
||||
impl_float_from_bool!(
|
||||
f128;
|
||||
doctest_prefix:
|
||||
///# #![allow(unused_features)]
|
||||
///#![feature(f128)]
|
||||
///# #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
|
||||
///
|
||||
|
||||
@@ -148,7 +148,10 @@ pub mod consts {
|
||||
pub const LN_10: f128 = 2.30258509299404568401799145468436420760110148862877297603333_f128;
|
||||
}
|
||||
|
||||
#[doc(test(attr(feature(cfg_target_has_reliable_f16_f128), allow(internal_features))))]
|
||||
#[doc(test(attr(
|
||||
feature(cfg_target_has_reliable_f16_f128),
|
||||
allow(internal_features, unused_features)
|
||||
)))]
|
||||
impl f128 {
|
||||
/// The radix or base of the internal representation of `f128`.
|
||||
#[unstable(feature = "f128", issue = "116909")]
|
||||
@@ -1470,7 +1473,11 @@ pub const fn algebraic_rem(self, rhs: f128) -> f128 {
|
||||
// Functions in this module fall into `core_float_math`
|
||||
// #[unstable(feature = "core_float_math", issue = "137578")]
|
||||
#[cfg(not(test))]
|
||||
#[doc(test(attr(feature(cfg_target_has_reliable_f16_f128), expect(internal_features))))]
|
||||
#[doc(test(attr(
|
||||
feature(cfg_target_has_reliable_f16_f128),
|
||||
expect(internal_features),
|
||||
allow(unused_features)
|
||||
)))]
|
||||
impl f128 {
|
||||
/// Returns the largest integer less than or equal to `self`.
|
||||
///
|
||||
|
||||
@@ -142,7 +142,10 @@ pub mod consts {
|
||||
pub const LN_10: f16 = 2.30258509299404568401799145468436421_f16;
|
||||
}
|
||||
|
||||
#[doc(test(attr(feature(cfg_target_has_reliable_f16_f128), allow(internal_features))))]
|
||||
#[doc(test(attr(
|
||||
feature(cfg_target_has_reliable_f16_f128),
|
||||
allow(internal_features, unused_features)
|
||||
)))]
|
||||
impl f16 {
|
||||
/// The radix or base of the internal representation of `f16`.
|
||||
#[unstable(feature = "f16", issue = "116909")]
|
||||
|
||||
@@ -1821,6 +1821,7 @@ pub const fn fract(x: f32) -> f32 {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![allow(unused_features)]
|
||||
/// #![feature(core_float_math)]
|
||||
///
|
||||
/// # // FIXME(#140515): mingw has an incorrect fma
|
||||
|
||||
@@ -1819,6 +1819,7 @@ pub const fn fract(x: f64) -> f64 {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![allow(unused_features)]
|
||||
/// #![feature(core_float_math)]
|
||||
///
|
||||
/// # // FIXME(#140515): mingw has an incorrect fma
|
||||
|
||||
@@ -3072,7 +3072,6 @@ pub const fn widening_mul(self, rhs: Self) -> (Self, Self) {
|
||||
/// implementing it for wider-than-native types.
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(const_unsigned_bigint_helpers)]
|
||||
/// fn scalar_mul_eq(little_endian_digits: &mut Vec<u16>, multiplicand: u16) {
|
||||
/// let mut carry = 0;
|
||||
/// for d in little_endian_digits.iter_mut() {
|
||||
@@ -3097,6 +3096,7 @@ pub const fn widening_mul(self, rhs: Self) -> (Self, Self) {
|
||||
/// except that it gives the value of the overflow instead of just whether one happened:
|
||||
///
|
||||
/// ```
|
||||
/// # #![allow(unused_features)]
|
||||
/// #![feature(const_unsigned_bigint_helpers)]
|
||||
/// let r = u8::carrying_mul(7, 13, 0);
|
||||
/// assert_eq!((r.0, r.1 != 0), u8::overflowing_mul(7, 13));
|
||||
@@ -3109,6 +3109,7 @@ pub const fn widening_mul(self, rhs: Self) -> (Self, Self) {
|
||||
/// [`wrapping_add`](Self::wrapping_add) methods:
|
||||
///
|
||||
/// ```
|
||||
/// # #![allow(unused_features)]
|
||||
/// #![feature(const_unsigned_bigint_helpers)]
|
||||
/// assert_eq!(
|
||||
/// 789_u16.carrying_mul(456, 123).0,
|
||||
|
||||
@@ -112,7 +112,6 @@ pub const fn of_val<T: MetaSized>(val: &T) -> Self {
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(ptr_alignment_type)]
|
||||
/// #![feature(layout_for_ptr)]
|
||||
/// use std::ptr::Alignment;
|
||||
///
|
||||
/// assert_eq!(unsafe { Alignment::of_val_raw(&5i32) }.as_usize(), 4);
|
||||
|
||||
@@ -1800,7 +1800,6 @@ pub const fn is_empty(self) -> bool {
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(raw_slice_split)]
|
||||
/// #![feature(slice_ptr_get)]
|
||||
///
|
||||
/// let mut v = [1, 0, 3, 0, 5, 6];
|
||||
/// let ptr = &mut v as *mut [_];
|
||||
|
||||
@@ -690,7 +690,6 @@ pub const fn checked_add(self, rhs: Duration) -> Option<Duration> {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(duration_constants)]
|
||||
/// use std::time::Duration;
|
||||
///
|
||||
/// assert_eq!(Duration::new(0, 0).saturating_add(Duration::new(0, 1)), Duration::new(0, 1));
|
||||
@@ -801,7 +800,6 @@ pub const fn checked_mul(self, rhs: u32) -> Option<Duration> {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(duration_constants)]
|
||||
/// use std::time::Duration;
|
||||
///
|
||||
/// assert_eq!(Duration::new(0, 500_000_001).saturating_mul(2), Duration::new(1, 2));
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#![feature(cfg_target_has_reliable_f16_f128)]
|
||||
#![feature(char_internals)]
|
||||
#![feature(char_max_len)]
|
||||
#![feature(clamp_magnitude)]
|
||||
#![feature(clone_to_uninit)]
|
||||
#![feature(const_array)]
|
||||
#![feature(const_bool)]
|
||||
@@ -35,7 +34,6 @@
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(const_unsigned_bigint_helpers)]
|
||||
#![feature(control_flow_ok)]
|
||||
#![feature(core_float_math)]
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(core_intrinsics_fallbacks)]
|
||||
#![feature(core_io_borrowed_buf)]
|
||||
@@ -47,7 +45,6 @@
|
||||
#![feature(drop_guard)]
|
||||
#![feature(duration_constants)]
|
||||
#![feature(duration_constructors)]
|
||||
#![feature(error_generic_member_access)]
|
||||
#![feature(exact_div)]
|
||||
#![feature(exact_size_is_empty)]
|
||||
#![feature(extend_one)]
|
||||
@@ -55,7 +52,6 @@
|
||||
#![feature(f16)]
|
||||
#![feature(f128)]
|
||||
#![feature(float_algebraic)]
|
||||
#![feature(float_gamma)]
|
||||
#![feature(float_minimum_maximum)]
|
||||
#![feature(flt2dec)]
|
||||
#![feature(fmt_internals)]
|
||||
@@ -94,7 +90,6 @@
|
||||
#![feature(nonzero_from_str_radix)]
|
||||
#![feature(numfmt)]
|
||||
#![feature(one_sided_range)]
|
||||
#![feature(option_reduce)]
|
||||
#![feature(pattern)]
|
||||
#![feature(pointer_is_aligned_to)]
|
||||
#![feature(portable_simd)]
|
||||
@@ -114,7 +109,6 @@
|
||||
#![feature(step_trait)]
|
||||
#![feature(str_internals)]
|
||||
#![feature(strict_provenance_lints)]
|
||||
#![feature(test)]
|
||||
#![feature(trusted_len)]
|
||||
#![feature(trusted_random_access)]
|
||||
#![feature(try_blocks)]
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
use crate::sys::cmath;
|
||||
|
||||
#[cfg(not(test))]
|
||||
#[doc(test(attr(allow(unused_features))))]
|
||||
impl f128 {
|
||||
/// Raises a number to a floating point power.
|
||||
///
|
||||
|
||||
@@ -916,7 +916,6 @@ pub fn atanh(self) -> f16 {
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(f16)]
|
||||
/// #![feature(float_gamma)]
|
||||
/// # #[cfg(not(miri))]
|
||||
/// # #[cfg(target_has_reliable_f16_math)] {
|
||||
///
|
||||
@@ -952,7 +951,6 @@ pub fn gamma(self) -> f16 {
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(f16)]
|
||||
/// #![feature(float_gamma)]
|
||||
/// # #[cfg(not(miri))]
|
||||
/// # #[cfg(target_has_reliable_f16_math)] {
|
||||
///
|
||||
@@ -988,7 +986,6 @@ pub fn ln_gamma(self) -> (f16, i32) {
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(f16)]
|
||||
/// #![feature(float_erf)]
|
||||
/// # #[cfg(not(miri))]
|
||||
/// # #[cfg(target_has_reliable_f16_math)] {
|
||||
/// /// The error function relates what percent of a normal distribution lies
|
||||
@@ -1028,7 +1025,6 @@ pub fn erf(self) -> f16 {
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(f16)]
|
||||
/// #![feature(float_erf)]
|
||||
/// # #[cfg(not(miri))]
|
||||
/// # #[cfg(target_has_reliable_f16_math)] {
|
||||
/// let x: f16 = 0.123;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#![feature(f16, f128, float_gamma, float_minimum_maximum, cfg_target_has_reliable_f16_f128)]
|
||||
#![feature(f16, f128, float_gamma, cfg_target_has_reliable_f16_f128)]
|
||||
#![expect(internal_features)] // for reliable_f16_f128
|
||||
|
||||
use std::fmt;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#![allow(stable_features)]
|
||||
#![feature(volatile)]
|
||||
|
||||
use std::ptr::{read_volatile, write_volatile};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#![allow(internal_features)]
|
||||
#![allow(internal_features, unused_features)]
|
||||
#![feature(stdarch_internal)]
|
||||
#![cfg_attr(target_arch = "arm", feature(stdarch_arm_feature_detection))]
|
||||
#![cfg_attr(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#![allow(internal_features)]
|
||||
#![allow(internal_features, unused_features)]
|
||||
#![cfg_attr(
|
||||
any(
|
||||
target_arch = "arm",
|
||||
|
||||
Reference in New Issue
Block a user