1
Fork 0

Rollup merge of #138082 - thaliaarchi:slice-cfg-not-test, r=thomcc

Remove `#[cfg(not(test))]` gates in `core`

These gates are unnecessary now that unit tests for `core` are in a separate package, `coretests`, instead of in the same files as the source code. They previously prevented the two `core` versions from conflicting with each other.
This commit is contained in:
许杰友 Jieyou Xu (Joe) 2025-03-16 09:40:05 +08:00 committed by GitHub
commit e0846806db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 90 additions and 127 deletions

View file

@ -1,4 +1,4 @@
From ad7ffe71baba46865f2e65266ab025920dfdc20b Mon Sep 17 00:00:00 2001 From 5d7c709608b01301d4628d2159265936d4440b67 Mon Sep 17 00:00:00 2001
From: bjorn3 <bjorn3@users.noreply.github.com> From: bjorn3 <bjorn3@users.noreply.github.com>
Date: Thu, 18 Feb 2021 18:45:28 +0100 Date: Thu, 18 Feb 2021 18:45:28 +0100
Subject: [PATCH] Disable 128bit atomic operations Subject: [PATCH] Disable 128bit atomic operations
@ -7,11 +7,10 @@ Cranelift doesn't support them yet
--- ---
library/core/src/panic/unwind_safe.rs | 6 ----- library/core/src/panic/unwind_safe.rs | 6 -----
library/core/src/sync/atomic.rs | 38 --------------------------- library/core/src/sync/atomic.rs | 38 ---------------------------
library/core/tests/atomic.rs | 4 --- 2 files changed, 44 deletions(-)
4 files changed, 4 insertions(+), 50 deletions(-)
diff --git a/library/core/src/panic/unwind_safe.rs b/library/core/src/panic/unwind_safe.rs diff --git a/library/core/src/panic/unwind_safe.rs b/library/core/src/panic/unwind_safe.rs
index 092b7cf..158cf71 100644 index a60f0799c0e..af056fbf41f 100644
--- a/library/core/src/panic/unwind_safe.rs --- a/library/core/src/panic/unwind_safe.rs
+++ b/library/core/src/panic/unwind_safe.rs +++ b/library/core/src/panic/unwind_safe.rs
@@ -216,9 +216,6 @@ impl RefUnwindSafe for crate::sync::atomic::AtomicI32 {} @@ -216,9 +216,6 @@ impl RefUnwindSafe for crate::sync::atomic::AtomicI32 {}
@ -21,7 +20,7 @@ index 092b7cf..158cf71 100644
-#[cfg(target_has_atomic_load_store = "128")] -#[cfg(target_has_atomic_load_store = "128")]
-#[unstable(feature = "integer_atomics", issue = "99069")] -#[unstable(feature = "integer_atomics", issue = "99069")]
-impl RefUnwindSafe for crate::sync::atomic::AtomicI128 {} -impl RefUnwindSafe for crate::sync::atomic::AtomicI128 {}
#[cfg(target_has_atomic_load_store = "ptr")] #[cfg(target_has_atomic_load_store = "ptr")]
#[stable(feature = "unwind_safe_atomic_refs", since = "1.14.0")] #[stable(feature = "unwind_safe_atomic_refs", since = "1.14.0")]
@@ -235,9 +232,6 @@ impl RefUnwindSafe for crate::sync::atomic::AtomicU32 {} @@ -235,9 +232,6 @@ impl RefUnwindSafe for crate::sync::atomic::AtomicU32 {}
@ -31,14 +30,14 @@ index 092b7cf..158cf71 100644
-#[cfg(target_has_atomic_load_store = "128")] -#[cfg(target_has_atomic_load_store = "128")]
-#[unstable(feature = "integer_atomics", issue = "99069")] -#[unstable(feature = "integer_atomics", issue = "99069")]
-impl RefUnwindSafe for crate::sync::atomic::AtomicU128 {} -impl RefUnwindSafe for crate::sync::atomic::AtomicU128 {}
#[cfg(target_has_atomic_load_store = "8")] #[cfg(target_has_atomic_load_store = "8")]
#[stable(feature = "unwind_safe_atomic_refs", since = "1.14.0")] #[stable(feature = "unwind_safe_atomic_refs", since = "1.14.0")]
diff --git a/library/core/src/sync/atomic.rs b/library/core/src/sync/atomic.rs diff --git a/library/core/src/sync/atomic.rs b/library/core/src/sync/atomic.rs
index d9de37e..8293fce 100644 index bf2b6d59f88..d5ccce03bbf 100644
--- a/library/core/src/sync/atomic.rs --- a/library/core/src/sync/atomic.rs
+++ b/library/core/src/sync/atomic.rs +++ b/library/core/src/sync/atomic.rs
@@ -2996,44 +2996,6 @@ atomic_int! { @@ -3585,44 +3585,6 @@ pub const fn as_ptr(&self) -> *mut $int_type {
8, 8,
u64 AtomicU64 u64 AtomicU64
} }
@ -54,7 +53,7 @@ index d9de37e..8293fce 100644
- unstable(feature = "integer_atomics", issue = "99069"), - unstable(feature = "integer_atomics", issue = "99069"),
- rustc_const_unstable(feature = "integer_atomics", issue = "99069"), - rustc_const_unstable(feature = "integer_atomics", issue = "99069"),
- rustc_const_unstable(feature = "integer_atomics", issue = "99069"), - rustc_const_unstable(feature = "integer_atomics", issue = "99069"),
- cfg_attr(not(test), rustc_diagnostic_item = "AtomicI128"), - rustc_diagnostic_item = "AtomicI128",
- "i128", - "i128",
- "#![feature(integer_atomics)]\n\n", - "#![feature(integer_atomics)]\n\n",
- atomic_min, atomic_max, - atomic_min, atomic_max,
@ -73,7 +72,7 @@ index d9de37e..8293fce 100644
- unstable(feature = "integer_atomics", issue = "99069"), - unstable(feature = "integer_atomics", issue = "99069"),
- rustc_const_unstable(feature = "integer_atomics", issue = "99069"), - rustc_const_unstable(feature = "integer_atomics", issue = "99069"),
- rustc_const_unstable(feature = "integer_atomics", issue = "99069"), - rustc_const_unstable(feature = "integer_atomics", issue = "99069"),
- cfg_attr(not(test), rustc_diagnostic_item = "AtomicU128"), - rustc_diagnostic_item = "AtomicU128",
- "u128", - "u128",
- "#![feature(integer_atomics)]\n\n", - "#![feature(integer_atomics)]\n\n",
- atomic_umin, atomic_umax, - atomic_umin, atomic_umax,
@ -83,7 +82,6 @@ index d9de37e..8293fce 100644
#[cfg(target_has_atomic_load_store = "ptr")] #[cfg(target_has_atomic_load_store = "ptr")]
macro_rules! atomic_int_ptr_sized { macro_rules! atomic_int_ptr_sized {
( $($target_pointer_width:literal $align:literal)* ) => { $( --
-- 2.48.1
2.26.2.7.g19db9cfb68

View file

@ -109,7 +109,7 @@ use crate::{fmt, hash, intrinsics};
// unsafe traits and unsafe methods (i.e., `type_id` would still be safe to call, // unsafe traits and unsafe methods (i.e., `type_id` would still be safe to call,
// but we would likely want to indicate as such in documentation). // but we would likely want to indicate as such in documentation).
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "Any")] #[rustc_diagnostic_item = "Any"]
pub trait Any: 'static { pub trait Any: 'static {
/// Gets the `TypeId` of `self`. /// Gets the `TypeId` of `self`.
/// ///

View file

@ -1,6 +1,5 @@
use crate::ascii; use crate::ascii;
#[cfg(not(test))]
impl<const N: usize> [u8; N] { impl<const N: usize> [u8; N] {
/// Converts this array of bytes into an array of ASCII characters, /// Converts this array of bytes into an array of ASCII characters,
/// or returns `None` if any of the characters is non-ASCII. /// or returns `None` if any of the characters is non-ASCII.

View file

@ -56,7 +56,7 @@ impl bool {
/// ``` /// ```
#[doc(alias = "then_with")] #[doc(alias = "then_with")]
#[stable(feature = "lazy_bool_to_option", since = "1.50.0")] #[stable(feature = "lazy_bool_to_option", since = "1.50.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "bool_then")] #[rustc_diagnostic_item = "bool_then"]
#[inline] #[inline]
pub fn then<T, F: FnOnce() -> T>(self, f: F) -> Option<T> { pub fn then<T, F: FnOnce() -> T>(self, f: F) -> Option<T> {
if self { Some(f()) } else { None } if self { Some(f()) } else { None }

View file

@ -304,7 +304,7 @@ pub use once::OnceCell;
/// ``` /// ```
/// ///
/// See the [module-level documentation](self) for more. /// See the [module-level documentation](self) for more.
#[cfg_attr(not(test), rustc_diagnostic_item = "Cell")] #[rustc_diagnostic_item = "Cell"]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[repr(transparent)] #[repr(transparent)]
#[rustc_pub_transparent] #[rustc_pub_transparent]
@ -725,7 +725,7 @@ impl<T, const N: usize> Cell<[T; N]> {
/// A mutable memory location with dynamically checked borrow rules /// A mutable memory location with dynamically checked borrow rules
/// ///
/// See the [module-level documentation](self) for more. /// See the [module-level documentation](self) for more.
#[cfg_attr(not(test), rustc_diagnostic_item = "RefCell")] #[rustc_diagnostic_item = "RefCell"]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct RefCell<T: ?Sized> { pub struct RefCell<T: ?Sized> {
borrow: Cell<BorrowFlag>, borrow: Cell<BorrowFlag>,

View file

@ -1178,7 +1178,7 @@ impl char {
#[must_use] #[must_use]
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")] #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
#[rustc_const_stable(feature = "const_char_is_ascii", since = "1.32.0")] #[rustc_const_stable(feature = "const_char_is_ascii", since = "1.32.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "char_is_ascii")] #[rustc_diagnostic_item = "char_is_ascii"]
#[inline] #[inline]
pub const fn is_ascii(&self) -> bool { pub const fn is_ascii(&self) -> bool {
*self as u32 <= 0x7F *self as u32 <= 0x7F

View file

@ -1481,7 +1481,7 @@ pub macro PartialOrd($item:item) {
#[inline] #[inline]
#[must_use] #[must_use]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "cmp_min")] #[rustc_diagnostic_item = "cmp_min"]
pub fn min<T: Ord>(v1: T, v2: T) -> T { pub fn min<T: Ord>(v1: T, v2: T) -> T {
v1.min(v2) v1.min(v2)
} }
@ -1573,7 +1573,7 @@ pub fn min_by_key<T, F: FnMut(&T) -> K, K: Ord>(v1: T, v2: T, mut f: F) -> T {
#[inline] #[inline]
#[must_use] #[must_use]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "cmp_max")] #[rustc_diagnostic_item = "cmp_max"]
pub fn max<T: Ord>(v1: T, v2: T) -> T { pub fn max<T: Ord>(v1: T, v2: T) -> T {
v1.max(v2) v1.max(v2)
} }

View file

@ -214,7 +214,7 @@ pub const fn identity<T>(x: T) -> T {
/// is_hello(s); /// is_hello(s);
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "AsRef")] #[rustc_diagnostic_item = "AsRef"]
pub trait AsRef<T: ?Sized> { pub trait AsRef<T: ?Sized> {
/// Converts this type into a shared reference of the (usually inferred) input type. /// Converts this type into a shared reference of the (usually inferred) input type.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -365,7 +365,7 @@ pub trait AsRef<T: ?Sized> {
/// Note, however, that APIs don't need to be generic. In many cases taking a `&mut [u8]` or /// Note, however, that APIs don't need to be generic. In many cases taking a `&mut [u8]` or
/// `&mut Vec<u8>`, for example, is the better choice (callers need to pass the correct type then). /// `&mut Vec<u8>`, for example, is the better choice (callers need to pass the correct type then).
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "AsMut")] #[rustc_diagnostic_item = "AsMut"]
pub trait AsMut<T: ?Sized> { pub trait AsMut<T: ?Sized> {
/// Converts this type into a mutable reference of the (usually inferred) input type. /// Converts this type into a mutable reference of the (usually inferred) input type.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]

View file

@ -101,7 +101,7 @@ use crate::ascii::Char as AsciiChar;
/// bar: f32, /// bar: f32,
/// } /// }
/// ``` /// ```
#[cfg_attr(not(test), rustc_diagnostic_item = "Default")] #[rustc_diagnostic_item = "Default"]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_trivial_field_reads] #[rustc_trivial_field_reads]
pub trait Default: Sized { pub trait Default: Sized {

View file

@ -47,7 +47,7 @@ use crate::fmt::{self, Debug, Display, Formatter};
/// impl Error for ReadConfigError {} /// impl Error for ReadConfigError {}
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "Error")] #[rustc_diagnostic_item = "Error"]
#[rustc_has_incoherent_inherent_impls] #[rustc_has_incoherent_inherent_impls]
#[allow(multiple_supertrait_upcastable)] #[allow(multiple_supertrait_upcastable)]
pub trait Error: Debug + Display { pub trait Error: Debug + Display {

View file

@ -18,7 +18,7 @@ mod num;
mod rt; mod rt;
#[stable(feature = "fmt_flags_align", since = "1.28.0")] #[stable(feature = "fmt_flags_align", since = "1.28.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "Alignment")] #[rustc_diagnostic_item = "Alignment"]
/// Possible alignments returned by `Formatter::align` /// Possible alignments returned by `Formatter::align`
#[derive(Copy, Clone, Debug, PartialEq, Eq)] #[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum Alignment { pub enum Alignment {

View file

@ -14,7 +14,7 @@ use crate::ops::Try;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
#[must_use = "iterators are lazy and do nothing unless consumed"] #[must_use = "iterators are lazy and do nothing unless consumed"]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "Enumerate")] #[rustc_diagnostic_item = "Enumerate"]
pub struct Enumerate<I> { pub struct Enumerate<I> {
iter: I, iter: I,
count: usize, count: usize,

View file

@ -56,7 +56,7 @@ use crate::num::NonZero;
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "iter_repeat")] #[rustc_diagnostic_item = "iter_repeat"]
pub fn repeat<T: Clone>(elt: T) -> Repeat<T> { pub fn repeat<T: Clone>(elt: T) -> Repeat<T> {
Repeat { element: elt } Repeat { element: elt }
} }

View file

@ -37,7 +37,7 @@ use crate::ops::{ControlFlow, Try};
/// assert_eq!(None, iter.next_back()); /// assert_eq!(None, iter.next_back());
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "DoubleEndedIterator")] #[rustc_diagnostic_item = "DoubleEndedIterator"]
pub trait DoubleEndedIterator: Iterator { pub trait DoubleEndedIterator: Iterator {
/// Removes and returns an element from the end of the iterator. /// Removes and returns an element from the end of the iterator.
/// ///

View file

@ -862,7 +862,7 @@ pub trait Iterator {
/// Note that `iter.filter(f).next()` is equivalent to `iter.find(f)`. /// Note that `iter.filter(f).next()` is equivalent to `iter.find(f)`.
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "iter_filter")] #[rustc_diagnostic_item = "iter_filter"]
fn filter<P>(self, predicate: P) -> Filter<Self, P> fn filter<P>(self, predicate: P) -> Filter<Self, P>
where where
Self: Sized, Self: Sized,
@ -954,7 +954,7 @@ pub trait Iterator {
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "enumerate_method")] #[rustc_diagnostic_item = "enumerate_method"]
fn enumerate(self) -> Enumerate<Self> fn enumerate(self) -> Enumerate<Self>
where where
Self: Sized, Self: Sized,
@ -1972,7 +1972,7 @@ pub trait Iterator {
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[must_use = "if you really need to exhaust the iterator, consider `.for_each(drop)` instead"] #[must_use = "if you really need to exhaust the iterator, consider `.for_each(drop)` instead"]
#[cfg_attr(not(test), rustc_diagnostic_item = "iterator_collect_fn")] #[rustc_diagnostic_item = "iterator_collect_fn"]
fn collect<B: FromIterator<Self::Item>>(self) -> B fn collect<B: FromIterator<Self::Item>>(self) -> B
where where
Self: Sized, Self: Sized,
@ -3367,7 +3367,7 @@ pub trait Iterator {
/// assert_eq!(v_map, vec![1, 2, 3]); /// assert_eq!(v_map, vec![1, 2, 3]);
/// ``` /// ```
#[stable(feature = "iter_copied", since = "1.36.0")] #[stable(feature = "iter_copied", since = "1.36.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "iter_copied")] #[rustc_diagnostic_item = "iter_copied"]
fn copied<'a, T: 'a>(self) -> Copied<Self> fn copied<'a, T: 'a>(self) -> Copied<Self>
where where
Self: Sized + Iterator<Item = &'a T>, Self: Sized + Iterator<Item = &'a T>,
@ -3415,7 +3415,7 @@ pub trait Iterator {
/// assert_eq!(&[vec![23]], &faster[..]); /// assert_eq!(&[vec![23]], &faster[..]);
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "iter_cloned")] #[rustc_diagnostic_item = "iter_cloned"]
fn cloned<'a, T: 'a>(self) -> Cloned<Self> fn cloned<'a, T: 'a>(self) -> Cloned<Self>
where where
Self: Sized + Iterator<Item = &'a T>, Self: Sized + Iterator<Item = &'a T>,

View file

@ -43,18 +43,6 @@
//! which do not trigger a panic can be assured that this function is never //! which do not trigger a panic can be assured that this function is never
//! called. The `lang` attribute is called `eh_personality`. //! called. The `lang` attribute is called `eh_personality`.
// Since core defines many fundamental lang items, all tests live in a
// separate crate, coretests (library/coretests), to avoid bizarre issues.
//
// Here we explicitly #[cfg]-out this whole crate when testing. If we don't do
// this, both the generated test artifact and the linked libtest (which
// transitively includes core) will both define the same set of lang items,
// and this will cause the E0152 "found duplicate lang item" error. See
// discussion in #50466 for details.
//
// This cfg won't affect doc tests.
#![cfg(not(test))]
//
#![stable(feature = "core", since = "1.6.0")] #![stable(feature = "core", since = "1.6.0")]
#![doc( #![doc(
html_playground_url = "https://play.rust-lang.org/", html_playground_url = "https://play.rust-lang.org/",
@ -64,7 +52,6 @@
)] )]
#![doc(rust_logo)] #![doc(rust_logo)]
#![doc(cfg_hide( #![doc(cfg_hide(
not(test),
no_fp_fmt_parse, no_fp_fmt_parse,
target_pointer_width = "16", target_pointer_width = "16",
target_pointer_width = "32", target_pointer_width = "32",
@ -228,13 +215,9 @@ extern crate self as core;
#[allow(unused)] #[allow(unused)]
use prelude::rust_2024::*; use prelude::rust_2024::*;
#[cfg(not(test))] // See #65860
#[macro_use] #[macro_use]
mod macros; mod macros;
// We don't export this through #[macro_export] for now, to avoid breakage.
// See https://github.com/rust-lang/rust/issues/82913
#[cfg(not(test))]
#[unstable(feature = "assert_matches", issue = "82775")] #[unstable(feature = "assert_matches", issue = "82775")]
/// Unstable module containing the unstable `assert_matches` macro. /// Unstable module containing the unstable `assert_matches` macro.
pub mod assert_matches { pub mod assert_matches {

View file

@ -37,7 +37,7 @@ macro_rules! panic {
/// ``` /// ```
#[macro_export] #[macro_export]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "assert_eq_macro")] #[rustc_diagnostic_item = "assert_eq_macro"]
#[allow_internal_unstable(panic_internals)] #[allow_internal_unstable(panic_internals)]
macro_rules! assert_eq { macro_rules! assert_eq {
($left:expr, $right:expr $(,)?) => { ($left:expr, $right:expr $(,)?) => {
@ -93,7 +93,7 @@ macro_rules! assert_eq {
/// ``` /// ```
#[macro_export] #[macro_export]
#[stable(feature = "assert_ne", since = "1.13.0")] #[stable(feature = "assert_ne", since = "1.13.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "assert_ne_macro")] #[rustc_diagnostic_item = "assert_ne_macro"]
#[allow_internal_unstable(panic_internals)] #[allow_internal_unstable(panic_internals)]
macro_rules! assert_ne { macro_rules! assert_ne {
($left:expr, $right:expr $(,)?) => { ($left:expr, $right:expr $(,)?) => {
@ -331,7 +331,7 @@ macro_rules! debug_assert {
/// ``` /// ```
#[macro_export] #[macro_export]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "debug_assert_eq_macro")] #[rustc_diagnostic_item = "debug_assert_eq_macro"]
macro_rules! debug_assert_eq { macro_rules! debug_assert_eq {
($($arg:tt)*) => { ($($arg:tt)*) => {
if $crate::cfg!(debug_assertions) { if $crate::cfg!(debug_assertions) {
@ -361,7 +361,7 @@ macro_rules! debug_assert_eq {
/// ``` /// ```
#[macro_export] #[macro_export]
#[stable(feature = "assert_ne", since = "1.13.0")] #[stable(feature = "assert_ne", since = "1.13.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "debug_assert_ne_macro")] #[rustc_diagnostic_item = "debug_assert_ne_macro"]
macro_rules! debug_assert_ne { macro_rules! debug_assert_ne {
($($arg:tt)*) => { ($($arg:tt)*) => {
if $crate::cfg!(debug_assertions) { if $crate::cfg!(debug_assertions) {
@ -442,7 +442,7 @@ pub macro debug_assert_matches($($arg:tt)*) {
/// ``` /// ```
#[macro_export] #[macro_export]
#[stable(feature = "matches_macro", since = "1.42.0")] #[stable(feature = "matches_macro", since = "1.42.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "matches_macro")] #[rustc_diagnostic_item = "matches_macro"]
macro_rules! matches { macro_rules! matches {
($expression:expr, $pattern:pat $(if $guard:expr)? $(,)?) => { ($expression:expr, $pattern:pat $(if $guard:expr)? $(,)?) => {
match $expression { match $expression {
@ -617,7 +617,7 @@ macro_rules! r#try {
/// ``` /// ```
#[macro_export] #[macro_export]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "write_macro")] #[rustc_diagnostic_item = "write_macro"]
macro_rules! write { macro_rules! write {
($dst:expr, $($arg:tt)*) => { ($dst:expr, $($arg:tt)*) => {
$dst.write_fmt($crate::format_args!($($arg)*)) $dst.write_fmt($crate::format_args!($($arg)*))
@ -651,7 +651,7 @@ macro_rules! write {
/// ``` /// ```
#[macro_export] #[macro_export]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "writeln_macro")] #[rustc_diagnostic_item = "writeln_macro"]
#[allow_internal_unstable(format_args_nl)] #[allow_internal_unstable(format_args_nl)]
macro_rules! writeln { macro_rules! writeln {
($dst:expr $(,)?) => { ($dst:expr $(,)?) => {
@ -718,7 +718,7 @@ macro_rules! writeln {
#[rustc_builtin_macro(unreachable)] #[rustc_builtin_macro(unreachable)]
#[allow_internal_unstable(edition_panic)] #[allow_internal_unstable(edition_panic)]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "unreachable_macro")] #[rustc_diagnostic_item = "unreachable_macro"]
macro_rules! unreachable { macro_rules! unreachable {
// Expands to either `$crate::panic::unreachable_2015` or `$crate::panic::unreachable_2021` // Expands to either `$crate::panic::unreachable_2015` or `$crate::panic::unreachable_2021`
// depending on the edition of the caller. // depending on the edition of the caller.
@ -803,7 +803,7 @@ macro_rules! unreachable {
/// ``` /// ```
#[macro_export] #[macro_export]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "unimplemented_macro")] #[rustc_diagnostic_item = "unimplemented_macro"]
#[allow_internal_unstable(panic_internals)] #[allow_internal_unstable(panic_internals)]
macro_rules! unimplemented { macro_rules! unimplemented {
() => { () => {
@ -883,7 +883,7 @@ macro_rules! unimplemented {
/// ``` /// ```
#[macro_export] #[macro_export]
#[stable(feature = "todo_macro", since = "1.40.0")] #[stable(feature = "todo_macro", since = "1.40.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "todo_macro")] #[rustc_diagnostic_item = "todo_macro"]
#[allow_internal_unstable(panic_internals)] #[allow_internal_unstable(panic_internals)]
macro_rules! todo { macro_rules! todo {
() => { () => {
@ -995,7 +995,7 @@ pub(crate) mod builtin {
/// and cannot be stored for later use. /// and cannot be stored for later use.
/// This is a known limitation, see [#92698](https://github.com/rust-lang/rust/issues/92698). /// This is a known limitation, see [#92698](https://github.com/rust-lang/rust/issues/92698).
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "format_args_macro")] #[rustc_diagnostic_item = "format_args_macro"]
#[allow_internal_unsafe] #[allow_internal_unsafe]
#[allow_internal_unstable(fmt_internals)] #[allow_internal_unstable(fmt_internals)]
#[rustc_builtin_macro] #[rustc_builtin_macro]
@ -1342,7 +1342,7 @@ pub(crate) mod builtin {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_builtin_macro] #[rustc_builtin_macro]
#[macro_export] #[macro_export]
#[cfg_attr(not(test), rustc_diagnostic_item = "include_str_macro")] #[rustc_diagnostic_item = "include_str_macro"]
macro_rules! include_str { macro_rules! include_str {
($file:expr $(,)?) => {{ /* compiler built-in */ }}; ($file:expr $(,)?) => {{ /* compiler built-in */ }};
} }
@ -1382,7 +1382,7 @@ pub(crate) mod builtin {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_builtin_macro] #[rustc_builtin_macro]
#[macro_export] #[macro_export]
#[cfg_attr(not(test), rustc_diagnostic_item = "include_bytes_macro")] #[rustc_diagnostic_item = "include_bytes_macro"]
macro_rules! include_bytes { macro_rules! include_bytes {
($file:expr $(,)?) => {{ /* compiler built-in */ }}; ($file:expr $(,)?) => {{ /* compiler built-in */ }};
} }

View file

@ -82,7 +82,7 @@ macro marker_impls {
/// [arc]: ../../std/sync/struct.Arc.html /// [arc]: ../../std/sync/struct.Arc.html
/// [ub]: ../../reference/behavior-considered-undefined.html /// [ub]: ../../reference/behavior-considered-undefined.html
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "Send")] #[rustc_diagnostic_item = "Send"]
#[diagnostic::on_unimplemented( #[diagnostic::on_unimplemented(
message = "`{Self}` cannot be sent between threads safely", message = "`{Self}` cannot be sent between threads safely",
label = "`{Self}` cannot be sent between threads safely" label = "`{Self}` cannot be sent between threads safely"
@ -545,7 +545,7 @@ pub trait BikeshedGuaranteedNoDrop {}
/// [transmute]: crate::mem::transmute /// [transmute]: crate::mem::transmute
/// [nomicon-send-and-sync]: ../../nomicon/send-and-sync.html /// [nomicon-send-and-sync]: ../../nomicon/send-and-sync.html
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "Sync")] #[rustc_diagnostic_item = "Sync"]
#[lang = "sync"] #[lang = "sync"]
#[rustc_on_unimplemented( #[rustc_on_unimplemented(
on( on(
@ -1305,7 +1305,7 @@ pub trait FnPtr: Copy + Clone {
/// ``` /// ```
#[rustc_builtin_macro(CoercePointee, attributes(pointee))] #[rustc_builtin_macro(CoercePointee, attributes(pointee))]
#[allow_internal_unstable(dispatch_from_dyn, coerce_unsized, unsize, coerce_pointee_validated)] #[allow_internal_unstable(dispatch_from_dyn, coerce_unsized, unsize, coerce_pointee_validated)]
#[cfg_attr(not(test), rustc_diagnostic_item = "CoercePointee")] #[rustc_diagnostic_item = "CoercePointee"]
#[unstable(feature = "derive_coerce_pointee", issue = "123430")] #[unstable(feature = "derive_coerce_pointee", issue = "123430")]
pub macro CoercePointee($item:item) { pub macro CoercePointee($item:item) {
/* compiler built-in */ /* compiler built-in */

View file

@ -140,7 +140,7 @@ pub use crate::intrinsics::transmute;
#[inline] #[inline]
#[rustc_const_stable(feature = "const_forget", since = "1.46.0")] #[rustc_const_stable(feature = "const_forget", since = "1.46.0")]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "mem_forget")] #[rustc_diagnostic_item = "mem_forget"]
pub const fn forget<T>(t: T) { pub const fn forget<T>(t: T) {
let _ = ManuallyDrop::new(t); let _ = ManuallyDrop::new(t);
} }
@ -300,7 +300,7 @@ pub fn forget_unsized<T: ?Sized>(t: T) {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_promotable] #[rustc_promotable]
#[rustc_const_stable(feature = "const_mem_size_of", since = "1.24.0")] #[rustc_const_stable(feature = "const_mem_size_of", since = "1.24.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "mem_size_of")] #[rustc_diagnostic_item = "mem_size_of"]
pub const fn size_of<T>() -> usize { pub const fn size_of<T>() -> usize {
intrinsics::size_of::<T>() intrinsics::size_of::<T>()
} }
@ -328,7 +328,7 @@ pub const fn size_of<T>() -> usize {
#[must_use] #[must_use]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_size_of_val", since = "1.85.0")] #[rustc_const_stable(feature = "const_size_of_val", since = "1.85.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "mem_size_of_val")] #[rustc_diagnostic_item = "mem_size_of_val"]
pub const fn size_of_val<T: ?Sized>(val: &T) -> usize { pub const fn size_of_val<T: ?Sized>(val: &T) -> usize {
// SAFETY: `val` is a reference, so it's a valid raw pointer // SAFETY: `val` is a reference, so it's a valid raw pointer
unsafe { intrinsics::size_of_val(val) } unsafe { intrinsics::size_of_val(val) }
@ -846,7 +846,7 @@ pub fn take<T: Default>(dest: &mut T) -> T {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[must_use = "if you don't need the old value, you can just assign the new value directly"] #[must_use = "if you don't need the old value, you can just assign the new value directly"]
#[rustc_const_stable(feature = "const_replace", since = "1.83.0")] #[rustc_const_stable(feature = "const_replace", since = "1.83.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "mem_replace")] #[rustc_diagnostic_item = "mem_replace"]
pub const fn replace<T>(dest: &mut T, src: T) -> T { pub const fn replace<T>(dest: &mut T, src: T) -> T {
// It may be tempting to use `swap` to avoid `unsafe` here. Don't! // It may be tempting to use `swap` to avoid `unsafe` here. Don't!
// The compiler optimizes the implementation below to two `memcpy`s // The compiler optimizes the implementation below to two `memcpy`s
@ -931,7 +931,7 @@ pub const fn replace<T>(dest: &mut T, src: T) -> T {
/// [`RefCell`]: crate::cell::RefCell /// [`RefCell`]: crate::cell::RefCell
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "mem_drop")] #[rustc_diagnostic_item = "mem_drop"]
pub fn drop<T>(_x: T) {} pub fn drop<T>(_x: T) {}
/// Bitwise-copies a value. /// Bitwise-copies a value.
@ -1154,7 +1154,7 @@ impl<T> fmt::Debug for Discriminant<T> {
/// ``` /// ```
#[stable(feature = "discriminant_value", since = "1.21.0")] #[stable(feature = "discriminant_value", since = "1.21.0")]
#[rustc_const_stable(feature = "const_discriminant", since = "1.75.0")] #[rustc_const_stable(feature = "const_discriminant", since = "1.75.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "mem_discriminant")] #[rustc_diagnostic_item = "mem_discriminant"]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const fn discriminant<T>(v: &T) -> Discriminant<T> { pub const fn discriminant<T>(v: &T) -> Discriminant<T> {
Discriminant(intrinsics::discriminant_value(v)) Discriminant(intrinsics::discriminant_value(v))

View file

@ -25,7 +25,7 @@ use crate::ops::{BitAnd, BitAndAssign, BitOr, BitOrAssign, Not};
/// assert_eq!(localhost_v4.is_ipv6(), false); /// assert_eq!(localhost_v4.is_ipv6(), false);
/// assert_eq!(localhost_v4.is_ipv4(), true); /// assert_eq!(localhost_v4.is_ipv4(), true);
/// ``` /// ```
#[cfg_attr(not(test), rustc_diagnostic_item = "IpAddr")] #[rustc_diagnostic_item = "IpAddr"]
#[stable(feature = "ip_addr", since = "1.7.0")] #[stable(feature = "ip_addr", since = "1.7.0")]
#[derive(Copy, Clone, Eq, PartialEq, Hash, PartialOrd, Ord)] #[derive(Copy, Clone, Eq, PartialEq, Hash, PartialOrd, Ord)]
pub enum IpAddr { pub enum IpAddr {

View file

@ -12,11 +12,9 @@
#![unstable(feature = "f128", issue = "116909")] #![unstable(feature = "f128", issue = "116909")]
use crate::convert::FloatToInt; use crate::convert::FloatToInt;
#[cfg(not(test))]
use crate::intrinsics;
use crate::mem;
use crate::num::FpCategory; use crate::num::FpCategory;
use crate::panic::const_assert; use crate::panic::const_assert;
use crate::{intrinsics, mem};
/// Basic mathematical constants. /// Basic mathematical constants.
#[unstable(feature = "f128", issue = "116909")] #[unstable(feature = "f128", issue = "116909")]
@ -138,7 +136,6 @@ pub mod consts {
pub const LN_10: f128 = 2.30258509299404568401799145468436420760110148862877297603333_f128; pub const LN_10: f128 = 2.30258509299404568401799145468436420760110148862877297603333_f128;
} }
#[cfg(not(test))]
impl f128 { impl f128 {
// FIXME(f16_f128): almost all methods in this `impl` are missing examples and a const // FIXME(f16_f128): almost all methods in this `impl` are missing examples and a const
// implementation. Add these once we can run code on all platforms and have f16/f128 in CTFE. // implementation. Add these once we can run code on all platforms and have f16/f128 in CTFE.

View file

@ -12,11 +12,9 @@
#![unstable(feature = "f16", issue = "116909")] #![unstable(feature = "f16", issue = "116909")]
use crate::convert::FloatToInt; use crate::convert::FloatToInt;
#[cfg(not(test))]
use crate::intrinsics;
use crate::mem;
use crate::num::FpCategory; use crate::num::FpCategory;
use crate::panic::const_assert; use crate::panic::const_assert;
use crate::{intrinsics, mem};
/// Basic mathematical constants. /// Basic mathematical constants.
#[unstable(feature = "f16", issue = "116909")] #[unstable(feature = "f16", issue = "116909")]
@ -133,7 +131,6 @@ pub mod consts {
pub const LN_10: f16 = 2.30258509299404568401799145468436421_f16; pub const LN_10: f16 = 2.30258509299404568401799145468436421_f16;
} }
#[cfg(not(test))]
impl f16 { impl f16 {
// FIXME(f16_f128): almost all methods in this `impl` are missing examples and a const // FIXME(f16_f128): almost all methods in this `impl` are missing examples and a const
// implementation. Add these once we can run code on all platforms and have f16/f128 in CTFE. // implementation. Add these once we can run code on all platforms and have f16/f128 in CTFE.

View file

@ -12,11 +12,9 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use crate::convert::FloatToInt; use crate::convert::FloatToInt;
#[cfg(not(test))]
use crate::intrinsics;
use crate::mem;
use crate::num::FpCategory; use crate::num::FpCategory;
use crate::panic::const_assert; use crate::panic::const_assert;
use crate::{intrinsics, mem};
/// The radix or base of the internal representation of `f32`. /// The radix or base of the internal representation of `f32`.
/// Use [`f32::RADIX`] instead. /// Use [`f32::RADIX`] instead.
@ -386,7 +384,6 @@ pub mod consts {
pub const LN_10: f32 = 2.30258509299404568401799145468436421_f32; pub const LN_10: f32 = 2.30258509299404568401799145468436421_f32;
} }
#[cfg(not(test))]
impl f32 { impl f32 {
/// The radix or base of the internal representation of `f32`. /// The radix or base of the internal representation of `f32`.
#[stable(feature = "assoc_int_consts", since = "1.43.0")] #[stable(feature = "assoc_int_consts", since = "1.43.0")]
@ -416,7 +413,7 @@ impl f32 {
/// [Machine epsilon]: https://en.wikipedia.org/wiki/Machine_epsilon /// [Machine epsilon]: https://en.wikipedia.org/wiki/Machine_epsilon
/// [`MANTISSA_DIGITS`]: f32::MANTISSA_DIGITS /// [`MANTISSA_DIGITS`]: f32::MANTISSA_DIGITS
#[stable(feature = "assoc_int_consts", since = "1.43.0")] #[stable(feature = "assoc_int_consts", since = "1.43.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "f32_epsilon")] #[rustc_diagnostic_item = "f32_epsilon"]
pub const EPSILON: f32 = 1.19209290e-07_f32; pub const EPSILON: f32 = 1.19209290e-07_f32;
/// Smallest finite `f32` value. /// Smallest finite `f32` value.

View file

@ -12,11 +12,9 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use crate::convert::FloatToInt; use crate::convert::FloatToInt;
#[cfg(not(test))]
use crate::intrinsics;
use crate::mem;
use crate::num::FpCategory; use crate::num::FpCategory;
use crate::panic::const_assert; use crate::panic::const_assert;
use crate::{intrinsics, mem};
/// The radix or base of the internal representation of `f64`. /// The radix or base of the internal representation of `f64`.
/// Use [`f64::RADIX`] instead. /// Use [`f64::RADIX`] instead.
@ -386,7 +384,6 @@ pub mod consts {
pub const LN_10: f64 = 2.30258509299404568401799145468436421_f64; pub const LN_10: f64 = 2.30258509299404568401799145468436421_f64;
} }
#[cfg(not(test))]
impl f64 { impl f64 {
/// The radix or base of the internal representation of `f64`. /// The radix or base of the internal representation of `f64`.
#[stable(feature = "assoc_int_consts", since = "1.43.0")] #[stable(feature = "assoc_int_consts", since = "1.43.0")]
@ -415,7 +412,7 @@ impl f64 {
/// [Machine epsilon]: https://en.wikipedia.org/wiki/Machine_epsilon /// [Machine epsilon]: https://en.wikipedia.org/wiki/Machine_epsilon
/// [`MANTISSA_DIGITS`]: f64::MANTISSA_DIGITS /// [`MANTISSA_DIGITS`]: f64::MANTISSA_DIGITS
#[stable(feature = "assoc_int_consts", since = "1.43.0")] #[stable(feature = "assoc_int_consts", since = "1.43.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "f64_epsilon")] #[rustc_diagnostic_item = "f64_epsilon"]
pub const EPSILON: f64 = 2.2204460492503131e-16_f64; pub const EPSILON: f64 = 2.2204460492503131e-16_f64;
/// Smallest finite `f64` value. /// Smallest finite `f64` value.

View file

@ -79,7 +79,7 @@ use crate::{convert, ops};
/// [`Break`]: ControlFlow::Break /// [`Break`]: ControlFlow::Break
/// [`Continue`]: ControlFlow::Continue /// [`Continue`]: ControlFlow::Continue
#[stable(feature = "control_flow_enum_type", since = "1.55.0")] #[stable(feature = "control_flow_enum_type", since = "1.55.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "ControlFlow")] #[rustc_diagnostic_item = "ControlFlow"]
// ControlFlow should not implement PartialOrd or Ord, per RFC 3058: // ControlFlow should not implement PartialOrd or Ord, per RFC 3058:
// https://rust-lang.github.io/rfcs/3058-try-trait-v2.html#traits-for-controlflow // https://rust-lang.github.io/rfcs/3058-try-trait-v2.html#traits-for-controlflow
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]

View file

@ -924,7 +924,7 @@ impl<T> Option<T> {
#[inline] #[inline]
#[track_caller] #[track_caller]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "option_expect")] #[rustc_diagnostic_item = "option_expect"]
#[rustc_allow_const_fn_unstable(const_precise_live_drops)] #[rustc_allow_const_fn_unstable(const_precise_live_drops)]
#[rustc_const_stable(feature = "const_option", since = "1.83.0")] #[rustc_const_stable(feature = "const_option", since = "1.83.0")]
pub const fn expect(self, msg: &str) -> T { pub const fn expect(self, msg: &str) -> T {
@ -969,7 +969,7 @@ impl<T> Option<T> {
#[inline(always)] #[inline(always)]
#[track_caller] #[track_caller]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "option_unwrap")] #[rustc_diagnostic_item = "option_unwrap"]
#[rustc_allow_const_fn_unstable(const_precise_live_drops)] #[rustc_allow_const_fn_unstable(const_precise_live_drops)]
#[rustc_const_stable(feature = "const_option", since = "1.83.0")] #[rustc_const_stable(feature = "const_option", since = "1.83.0")]
pub const fn unwrap(self) -> T { pub const fn unwrap(self) -> T {

View file

@ -82,7 +82,7 @@ use crate::task::{Context, Poll};
/// [`AssertUnwindSafe`] wrapper struct can be used to force this trait to be /// [`AssertUnwindSafe`] wrapper struct can be used to force this trait to be
/// implemented for any closed over variables passed to `catch_unwind`. /// implemented for any closed over variables passed to `catch_unwind`.
#[stable(feature = "catch_unwind", since = "1.9.0")] #[stable(feature = "catch_unwind", since = "1.9.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "unwind_safe_trait")] #[rustc_diagnostic_item = "unwind_safe_trait"]
#[diagnostic::on_unimplemented( #[diagnostic::on_unimplemented(
message = "the type `{Self}` may not be safely transferred across an unwind boundary", message = "the type `{Self}` may not be safely transferred across an unwind boundary",
label = "`{Self}` may not be safely transferred across an unwind boundary" label = "`{Self}` may not be safely transferred across an unwind boundary"
@ -98,7 +98,7 @@ pub auto trait UnwindSafe {}
/// This is a "helper marker trait" used to provide impl blocks for the /// This is a "helper marker trait" used to provide impl blocks for the
/// [`UnwindSafe`] trait, for more information see that documentation. /// [`UnwindSafe`] trait, for more information see that documentation.
#[stable(feature = "catch_unwind", since = "1.9.0")] #[stable(feature = "catch_unwind", since = "1.9.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "ref_unwind_safe_trait")] #[rustc_diagnostic_item = "ref_unwind_safe_trait"]
#[diagnostic::on_unimplemented( #[diagnostic::on_unimplemented(
message = "the type `{Self}` may contain interior mutability and a reference may not be safely \ message = "the type `{Self}` may contain interior mutability and a reference may not be safely \
transferrable across a catch_unwind boundary", transferrable across a catch_unwind boundary",

View file

@ -654,7 +654,7 @@ impl<T, E> Result<T, E> {
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "result_ok_method")] #[rustc_diagnostic_item = "result_ok_method"]
pub fn ok(self) -> Option<T> { pub fn ok(self) -> Option<T> {
match self { match self {
Ok(x) => Some(x), Ok(x) => Some(x),

View file

@ -7,7 +7,6 @@ use crate::fmt::{self, Write};
use crate::intrinsics::const_eval_select; use crate::intrinsics::const_eval_select;
use crate::{ascii, iter, ops}; use crate::{ascii, iter, ops};
#[cfg(not(test))]
impl [u8] { impl [u8] {
/// Checks if all bytes in this slice are within the ASCII range. /// Checks if all bytes in this slice are within the ASCII range.
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")] #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]

View file

@ -97,7 +97,6 @@ enum Direction {
Back, Back,
} }
#[cfg(not(test))]
impl<T> [T] { impl<T> [T] {
/// Returns the number of elements in the slice. /// Returns the number of elements in the slice.
/// ///
@ -1045,7 +1044,7 @@ impl<T> [T] {
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]
#[cfg_attr(not(test), rustc_diagnostic_item = "slice_iter")] #[rustc_diagnostic_item = "slice_iter"]
pub fn iter(&self) -> Iter<'_, T> { pub fn iter(&self) -> Iter<'_, T> {
Iter::new(self) Iter::new(self)
} }
@ -4844,7 +4843,6 @@ impl<T, const N: usize> [[T; N]] {
} }
} }
#[cfg(not(test))]
impl [f32] { impl [f32] {
/// Sorts the slice of floats. /// Sorts the slice of floats.
/// ///
@ -4873,7 +4871,6 @@ impl [f32] {
} }
} }
#[cfg(not(test))]
impl [f64] { impl [f64] {
/// Sorts the slice of floats. /// Sorts the slice of floats.
/// ///

View file

@ -114,7 +114,6 @@ fn slice_error_fail_rt(s: &str, begin: usize, end: usize) -> ! {
); );
} }
#[cfg(not(test))]
impl str { impl str {
/// Returns the length of `self`. /// Returns the length of `self`.
/// ///
@ -134,7 +133,7 @@ impl str {
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_str_len", since = "1.39.0")] #[rustc_const_stable(feature = "const_str_len", since = "1.39.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "str_len")] #[rustc_diagnostic_item = "str_len"]
#[must_use] #[must_use]
#[inline] #[inline]
pub const fn len(&self) -> usize { pub const fn len(&self) -> usize {
@ -1029,7 +1028,7 @@ impl str {
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]
#[cfg_attr(not(test), rustc_diagnostic_item = "str_chars")] #[rustc_diagnostic_item = "str_chars"]
pub fn chars(&self) -> Chars<'_> { pub fn chars(&self) -> Chars<'_> {
Chars { iter: self.as_bytes().iter() } Chars { iter: self.as_bytes().iter() }
} }
@ -1160,7 +1159,7 @@ impl str {
#[must_use = "this returns the split string as an iterator, \ #[must_use = "this returns the split string as an iterator, \
without modifying the original"] without modifying the original"]
#[stable(feature = "split_whitespace", since = "1.1.0")] #[stable(feature = "split_whitespace", since = "1.1.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "str_split_whitespace")] #[rustc_diagnostic_item = "str_split_whitespace"]
#[inline] #[inline]
pub fn split_whitespace(&self) -> SplitWhitespace<'_> { pub fn split_whitespace(&self) -> SplitWhitespace<'_> {
SplitWhitespace { inner: self.split(IsWhitespace).filter(IsNotEmpty) } SplitWhitespace { inner: self.split(IsWhitespace).filter(IsNotEmpty) }
@ -1355,7 +1354,7 @@ impl str {
/// assert!(bananas.starts_with(&['a', 'b', 'c', 'd'])); /// assert!(bananas.starts_with(&['a', 'b', 'c', 'd']));
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "str_starts_with")] #[rustc_diagnostic_item = "str_starts_with"]
pub fn starts_with<P: Pattern>(&self, pat: P) -> bool { pub fn starts_with<P: Pattern>(&self, pat: P) -> bool {
pat.is_prefix_of(self) pat.is_prefix_of(self)
} }
@ -1380,7 +1379,7 @@ impl str {
/// assert!(!bananas.ends_with("nana")); /// assert!(!bananas.ends_with("nana"));
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "str_ends_with")] #[rustc_diagnostic_item = "str_ends_with"]
pub fn ends_with<P: Pattern>(&self, pat: P) -> bool pub fn ends_with<P: Pattern>(&self, pat: P) -> bool
where where
for<'a> P::Searcher<'a>: ReverseSearcher<'a>, for<'a> P::Searcher<'a>: ReverseSearcher<'a>,
@ -2114,7 +2113,7 @@ impl str {
#[must_use = "this returns the trimmed string as a slice, \ #[must_use = "this returns the trimmed string as a slice, \
without modifying the original"] without modifying the original"]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "str_trim")] #[rustc_diagnostic_item = "str_trim"]
pub fn trim(&self) -> &str { pub fn trim(&self) -> &str {
self.trim_matches(|c: char| c.is_whitespace()) self.trim_matches(|c: char| c.is_whitespace())
} }
@ -2153,7 +2152,7 @@ impl str {
#[must_use = "this returns the trimmed string as a new slice, \ #[must_use = "this returns the trimmed string as a new slice, \
without modifying the original"] without modifying the original"]
#[stable(feature = "trim_direction", since = "1.30.0")] #[stable(feature = "trim_direction", since = "1.30.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "str_trim_start")] #[rustc_diagnostic_item = "str_trim_start"]
pub fn trim_start(&self) -> &str { pub fn trim_start(&self) -> &str {
self.trim_start_matches(|c: char| c.is_whitespace()) self.trim_start_matches(|c: char| c.is_whitespace())
} }
@ -2192,7 +2191,7 @@ impl str {
#[must_use = "this returns the trimmed string as a new slice, \ #[must_use = "this returns the trimmed string as a new slice, \
without modifying the original"] without modifying the original"]
#[stable(feature = "trim_direction", since = "1.30.0")] #[stable(feature = "trim_direction", since = "1.30.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "str_trim_end")] #[rustc_diagnostic_item = "str_trim_end"]
pub fn trim_end(&self) -> &str { pub fn trim_end(&self) -> &str {
self.trim_end_matches(|c: char| c.is_whitespace()) self.trim_end_matches(|c: char| c.is_whitespace())
} }

View file

@ -295,7 +295,7 @@ unsafe impl Sync for AtomicBool {}
/// loads and stores of pointers. Its size depends on the target pointer's size. /// loads and stores of pointers. Its size depends on the target pointer's size.
#[cfg(target_has_atomic_load_store = "ptr")] #[cfg(target_has_atomic_load_store = "ptr")]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "AtomicPtr")] #[rustc_diagnostic_item = "AtomicPtr"]
#[cfg_attr(target_pointer_width = "16", repr(C, align(2)))] #[cfg_attr(target_pointer_width = "16", repr(C, align(2)))]
#[cfg_attr(target_pointer_width = "32", repr(C, align(4)))] #[cfg_attr(target_pointer_width = "32", repr(C, align(4)))]
#[cfg_attr(target_pointer_width = "64", repr(C, align(8)))] #[cfg_attr(target_pointer_width = "64", repr(C, align(8)))]
@ -3446,7 +3446,7 @@ atomic_int! {
stable(feature = "integer_atomics_stable", since = "1.34.0"), stable(feature = "integer_atomics_stable", since = "1.34.0"),
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"), rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
rustc_const_stable(feature = "const_atomic_into_inner", since = "1.79.0"), rustc_const_stable(feature = "const_atomic_into_inner", since = "1.79.0"),
cfg_attr(not(test), rustc_diagnostic_item = "AtomicI8"), rustc_diagnostic_item = "AtomicI8",
"i8", "i8",
"", "",
atomic_min, atomic_max, atomic_min, atomic_max,
@ -3465,7 +3465,7 @@ atomic_int! {
stable(feature = "integer_atomics_stable", since = "1.34.0"), stable(feature = "integer_atomics_stable", since = "1.34.0"),
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"), rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
rustc_const_stable(feature = "const_atomic_into_inner", since = "1.79.0"), rustc_const_stable(feature = "const_atomic_into_inner", since = "1.79.0"),
cfg_attr(not(test), rustc_diagnostic_item = "AtomicU8"), rustc_diagnostic_item = "AtomicU8",
"u8", "u8",
"", "",
atomic_umin, atomic_umax, atomic_umin, atomic_umax,
@ -3484,7 +3484,7 @@ atomic_int! {
stable(feature = "integer_atomics_stable", since = "1.34.0"), stable(feature = "integer_atomics_stable", since = "1.34.0"),
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"), rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
rustc_const_stable(feature = "const_atomic_into_inner", since = "1.79.0"), rustc_const_stable(feature = "const_atomic_into_inner", since = "1.79.0"),
cfg_attr(not(test), rustc_diagnostic_item = "AtomicI16"), rustc_diagnostic_item = "AtomicI16",
"i16", "i16",
"", "",
atomic_min, atomic_max, atomic_min, atomic_max,
@ -3503,7 +3503,7 @@ atomic_int! {
stable(feature = "integer_atomics_stable", since = "1.34.0"), stable(feature = "integer_atomics_stable", since = "1.34.0"),
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"), rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
rustc_const_stable(feature = "const_atomic_into_inner", since = "1.79.0"), rustc_const_stable(feature = "const_atomic_into_inner", since = "1.79.0"),
cfg_attr(not(test), rustc_diagnostic_item = "AtomicU16"), rustc_diagnostic_item = "AtomicU16",
"u16", "u16",
"", "",
atomic_umin, atomic_umax, atomic_umin, atomic_umax,
@ -3522,7 +3522,7 @@ atomic_int! {
stable(feature = "integer_atomics_stable", since = "1.34.0"), stable(feature = "integer_atomics_stable", since = "1.34.0"),
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"), rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
rustc_const_stable(feature = "const_atomic_into_inner", since = "1.79.0"), rustc_const_stable(feature = "const_atomic_into_inner", since = "1.79.0"),
cfg_attr(not(test), rustc_diagnostic_item = "AtomicI32"), rustc_diagnostic_item = "AtomicI32",
"i32", "i32",
"", "",
atomic_min, atomic_max, atomic_min, atomic_max,
@ -3541,7 +3541,7 @@ atomic_int! {
stable(feature = "integer_atomics_stable", since = "1.34.0"), stable(feature = "integer_atomics_stable", since = "1.34.0"),
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"), rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
rustc_const_stable(feature = "const_atomic_into_inner", since = "1.79.0"), rustc_const_stable(feature = "const_atomic_into_inner", since = "1.79.0"),
cfg_attr(not(test), rustc_diagnostic_item = "AtomicU32"), rustc_diagnostic_item = "AtomicU32",
"u32", "u32",
"", "",
atomic_umin, atomic_umax, atomic_umin, atomic_umax,
@ -3560,7 +3560,7 @@ atomic_int! {
stable(feature = "integer_atomics_stable", since = "1.34.0"), stable(feature = "integer_atomics_stable", since = "1.34.0"),
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"), rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
rustc_const_stable(feature = "const_atomic_into_inner", since = "1.79.0"), rustc_const_stable(feature = "const_atomic_into_inner", since = "1.79.0"),
cfg_attr(not(test), rustc_diagnostic_item = "AtomicI64"), rustc_diagnostic_item = "AtomicI64",
"i64", "i64",
"", "",
atomic_min, atomic_max, atomic_min, atomic_max,
@ -3579,7 +3579,7 @@ atomic_int! {
stable(feature = "integer_atomics_stable", since = "1.34.0"), stable(feature = "integer_atomics_stable", since = "1.34.0"),
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"), rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
rustc_const_stable(feature = "const_atomic_into_inner", since = "1.79.0"), rustc_const_stable(feature = "const_atomic_into_inner", since = "1.79.0"),
cfg_attr(not(test), rustc_diagnostic_item = "AtomicU64"), rustc_diagnostic_item = "AtomicU64",
"u64", "u64",
"", "",
atomic_umin, atomic_umax, atomic_umin, atomic_umax,
@ -3598,7 +3598,7 @@ atomic_int! {
unstable(feature = "integer_atomics", issue = "99069"), unstable(feature = "integer_atomics", issue = "99069"),
rustc_const_unstable(feature = "integer_atomics", issue = "99069"), rustc_const_unstable(feature = "integer_atomics", issue = "99069"),
rustc_const_unstable(feature = "integer_atomics", issue = "99069"), rustc_const_unstable(feature = "integer_atomics", issue = "99069"),
cfg_attr(not(test), rustc_diagnostic_item = "AtomicI128"), rustc_diagnostic_item = "AtomicI128",
"i128", "i128",
"#![feature(integer_atomics)]\n\n", "#![feature(integer_atomics)]\n\n",
atomic_min, atomic_max, atomic_min, atomic_max,
@ -3617,7 +3617,7 @@ atomic_int! {
unstable(feature = "integer_atomics", issue = "99069"), unstable(feature = "integer_atomics", issue = "99069"),
rustc_const_unstable(feature = "integer_atomics", issue = "99069"), rustc_const_unstable(feature = "integer_atomics", issue = "99069"),
rustc_const_unstable(feature = "integer_atomics", issue = "99069"), rustc_const_unstable(feature = "integer_atomics", issue = "99069"),
cfg_attr(not(test), rustc_diagnostic_item = "AtomicU128"), rustc_diagnostic_item = "AtomicU128",
"u128", "u128",
"#![feature(integer_atomics)]\n\n", "#![feature(integer_atomics)]\n\n",
atomic_umin, atomic_umax, atomic_umin, atomic_umax,
@ -3640,7 +3640,7 @@ macro_rules! atomic_int_ptr_sized {
stable(feature = "atomic_nand", since = "1.27.0"), stable(feature = "atomic_nand", since = "1.27.0"),
rustc_const_stable(feature = "const_ptr_sized_atomics", since = "1.24.0"), rustc_const_stable(feature = "const_ptr_sized_atomics", since = "1.24.0"),
rustc_const_stable(feature = "const_atomic_into_inner", since = "1.79.0"), rustc_const_stable(feature = "const_atomic_into_inner", since = "1.79.0"),
cfg_attr(not(test), rustc_diagnostic_item = "AtomicIsize"), rustc_diagnostic_item = "AtomicIsize",
"isize", "isize",
"", "",
atomic_min, atomic_max, atomic_min, atomic_max,
@ -3659,7 +3659,7 @@ macro_rules! atomic_int_ptr_sized {
stable(feature = "atomic_nand", since = "1.27.0"), stable(feature = "atomic_nand", since = "1.27.0"),
rustc_const_stable(feature = "const_ptr_sized_atomics", since = "1.24.0"), rustc_const_stable(feature = "const_ptr_sized_atomics", since = "1.24.0"),
rustc_const_stable(feature = "const_atomic_into_inner", since = "1.79.0"), rustc_const_stable(feature = "const_atomic_into_inner", since = "1.79.0"),
cfg_attr(not(test), rustc_diagnostic_item = "AtomicUsize"), rustc_diagnostic_item = "AtomicUsize",
"usize", "usize",
"", "",
atomic_umin, atomic_umax, atomic_umin, atomic_umax,

View file

@ -402,7 +402,7 @@ impl<'a> ContextBuilder<'a> {
/// [`Wake`]: ../../alloc/task/trait.Wake.html /// [`Wake`]: ../../alloc/task/trait.Wake.html
#[repr(transparent)] #[repr(transparent)]
#[stable(feature = "futures_api", since = "1.36.0")] #[stable(feature = "futures_api", since = "1.36.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "Waker")] #[rustc_diagnostic_item = "Waker"]
pub struct Waker { pub struct Waker {
waker: RawWaker, waker: RawWaker,
} }

View file

@ -77,7 +77,7 @@ const DAYS_PER_WEEK: u64 = 7;
/// crate to do so. /// crate to do so.
#[stable(feature = "duration", since = "1.3.0")] #[stable(feature = "duration", since = "1.3.0")]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[cfg_attr(not(test), rustc_diagnostic_item = "Duration")] #[rustc_diagnostic_item = "Duration"]
pub struct Duration { pub struct Duration {
secs: u64, secs: u64,
nanos: Nanoseconds, // Always 0 <= nanos < NANOS_PER_SEC nanos: Nanoseconds, // Always 0 <= nanos < NANOS_PER_SEC