diff options
Diffstat (limited to 'library/core/src')
| -rw-r--r-- | library/core/src/cell.rs | 2 | ||||
| -rw-r--r-- | library/core/src/cell/once.rs | 32 | ||||
| -rw-r--r-- | library/core/src/fmt/mod.rs | 11 | ||||
| -rw-r--r-- | library/core/src/future/mod.rs | 1 | ||||
| -rw-r--r-- | library/core/src/intrinsics.rs | 4 | ||||
| -rw-r--r-- | library/core/src/iter/adapters/chain.rs | 2 | ||||
| -rw-r--r-- | library/core/src/iter/adapters/cloned.rs | 2 | ||||
| -rw-r--r-- | library/core/src/iter/adapters/copied.rs | 2 | ||||
| -rw-r--r-- | library/core/src/iter/adapters/enumerate.rs | 2 | ||||
| -rw-r--r-- | library/core/src/iter/adapters/flatten.rs | 2 | ||||
| -rw-r--r-- | library/core/src/iter/adapters/fuse.rs | 2 | ||||
| -rw-r--r-- | library/core/src/iter/adapters/rev.rs | 2 | ||||
| -rw-r--r-- | library/core/src/marker.rs | 1 | ||||
| -rw-r--r-- | library/core/src/num/nonzero.rs | 8 | ||||
| -rw-r--r-- | library/core/src/option.rs | 18 | ||||
| -rw-r--r-- | library/core/src/panicking.rs | 2 | ||||
| -rw-r--r-- | library/core/src/primitive_docs.rs | 75 | ||||
| -rw-r--r-- | library/core/src/ptr/mod.rs | 243 | ||||
| -rw-r--r-- | library/core/src/ptr/non_null.rs | 2 | ||||
| -rw-r--r-- | library/core/src/result.rs | 4 | ||||
| -rw-r--r-- | library/core/src/slice/iter/macros.rs | 2 | ||||
| -rw-r--r-- | library/core/src/sync/atomic.rs | 12 |
22 files changed, 102 insertions, 329 deletions
diff --git a/library/core/src/cell.rs b/library/core/src/cell.rs index bcca8d924cd..f69a1f94e8f 100644 --- a/library/core/src/cell.rs +++ b/library/core/src/cell.rs @@ -247,7 +247,7 @@ mod once; #[unstable(feature = "lazy_cell", issue = "109736")] pub use lazy::LazyCell; -#[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")] +#[stable(feature = "once_cell", since = "1.70.0")] pub use once::OnceCell; /// A mutable memory location. diff --git a/library/core/src/cell/once.rs b/library/core/src/cell/once.rs index a7cd59e50fc..5f06a7b0795 100644 --- a/library/core/src/cell/once.rs +++ b/library/core/src/cell/once.rs @@ -29,7 +29,7 @@ use crate::mem; /// assert_eq!(value, "Hello, World!"); /// assert!(cell.get().is_some()); /// ``` -#[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")] +#[stable(feature = "once_cell", since = "1.70.0")] pub struct OnceCell<T> { // Invariant: written to at most once. inner: UnsafeCell<Option<T>>, @@ -39,8 +39,8 @@ impl<T> OnceCell<T> { /// Creates a new empty cell. #[inline] #[must_use] - #[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")] - #[rustc_const_stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "once_cell", since = "1.70.0")] + #[rustc_const_stable(feature = "once_cell", since = "1.70.0")] pub const fn new() -> OnceCell<T> { OnceCell { inner: UnsafeCell::new(None) } } @@ -49,7 +49,7 @@ impl<T> OnceCell<T> { /// /// Returns `None` if the cell is empty. #[inline] - #[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "once_cell", since = "1.70.0")] pub fn get(&self) -> Option<&T> { // SAFETY: Safe due to `inner`'s invariant unsafe { &*self.inner.get() }.as_ref() @@ -59,7 +59,7 @@ impl<T> OnceCell<T> { /// /// Returns `None` if the cell is empty. #[inline] - #[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "once_cell", since = "1.70.0")] pub fn get_mut(&mut self) -> Option<&mut T> { self.inner.get_mut().as_mut() } @@ -85,7 +85,7 @@ impl<T> OnceCell<T> { /// assert!(cell.get().is_some()); /// ``` #[inline] - #[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "once_cell", since = "1.70.0")] pub fn set(&self, value: T) -> Result<(), T> { // SAFETY: Safe because we cannot have overlapping mutable borrows let slot = unsafe { &*self.inner.get() }; @@ -125,7 +125,7 @@ impl<T> OnceCell<T> { /// assert_eq!(value, &92); /// ``` #[inline] - #[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "once_cell", since = "1.70.0")] pub fn get_or_init<F>(&self, f: F) -> &T where F: FnOnce() -> T, @@ -206,7 +206,7 @@ impl<T> OnceCell<T> { /// assert_eq!(cell.into_inner(), Some("hello".to_string())); /// ``` #[inline] - #[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "once_cell", since = "1.70.0")] pub fn into_inner(self) -> Option<T> { // Because `into_inner` takes `self` by value, the compiler statically verifies // that it is not currently borrowed. So it is safe to move out `Option<T>`. @@ -233,13 +233,13 @@ impl<T> OnceCell<T> { /// assert_eq!(cell.get(), None); /// ``` #[inline] - #[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "once_cell", since = "1.70.0")] pub fn take(&mut self) -> Option<T> { mem::take(self).into_inner() } } -#[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")] +#[stable(feature = "once_cell", since = "1.70.0")] impl<T> Default for OnceCell<T> { #[inline] fn default() -> Self { @@ -247,7 +247,7 @@ impl<T> Default for OnceCell<T> { } } -#[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")] +#[stable(feature = "once_cell", since = "1.70.0")] impl<T: fmt::Debug> fmt::Debug for OnceCell<T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self.get() { @@ -257,7 +257,7 @@ impl<T: fmt::Debug> fmt::Debug for OnceCell<T> { } } -#[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")] +#[stable(feature = "once_cell", since = "1.70.0")] impl<T: Clone> Clone for OnceCell<T> { #[inline] fn clone(&self) -> OnceCell<T> { @@ -272,7 +272,7 @@ impl<T: Clone> Clone for OnceCell<T> { } } -#[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")] +#[stable(feature = "once_cell", since = "1.70.0")] impl<T: PartialEq> PartialEq for OnceCell<T> { #[inline] fn eq(&self, other: &Self) -> bool { @@ -280,10 +280,10 @@ impl<T: PartialEq> PartialEq for OnceCell<T> { } } -#[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")] +#[stable(feature = "once_cell", since = "1.70.0")] impl<T: Eq> Eq for OnceCell<T> {} -#[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")] +#[stable(feature = "once_cell", since = "1.70.0")] impl<T> From<T> for OnceCell<T> { /// Creates a new `OnceCell<T>` which already contains the given `value`. #[inline] @@ -293,5 +293,5 @@ impl<T> From<T> for OnceCell<T> { } // Just like for `Cell<T>` this isn't needed, but results in nicer error messages. -#[stable(feature = "once_cell", since = "CURRENT_RUSTC_VERSION")] +#[stable(feature = "once_cell", since = "1.70.0")] impl<T> !Sync for OnceCell<T> {} diff --git a/library/core/src/fmt/mod.rs b/library/core/src/fmt/mod.rs index f4f32232570..e193332f155 100644 --- a/library/core/src/fmt/mod.rs +++ b/library/core/src/fmt/mod.rs @@ -303,7 +303,6 @@ impl<'a> Arguments<'a> { /// When using the format_args!() macro, this function is used to generate the /// Arguments structure. - #[cfg(not(bootstrap))] #[inline] pub fn new_v1(pieces: &'a [&'static str], args: &'a [rt::Argument<'a>]) -> Arguments<'a> { if pieces.len() < args.len() || pieces.len() > args.len() + 1 { @@ -312,16 +311,6 @@ impl<'a> Arguments<'a> { Arguments { pieces, fmt: None, args } } - #[cfg(bootstrap)] - #[inline] - #[rustc_const_unstable(feature = "const_fmt_arguments_new", issue = "none")] - pub const fn new_v1(pieces: &'a [&'static str], args: &'a [rt::Argument<'a>]) -> Arguments<'a> { - if pieces.len() < args.len() || pieces.len() > args.len() + 1 { - panic!("invalid args"); - } - Arguments { pieces, fmt: None, args } - } - /// This function is used to specify nonstandard formatting parameters. /// /// An `rt::UnsafeArg` is required because the following invariants must be held diff --git a/library/core/src/future/mod.rs b/library/core/src/future/mod.rs index 04f02d47f92..7a8d0cacdec 100644 --- a/library/core/src/future/mod.rs +++ b/library/core/src/future/mod.rs @@ -70,7 +70,6 @@ pub unsafe fn get_context<'a, 'b>(cx: ResumeTy) -> &'a mut Context<'b> { #[doc(hidden)] #[unstable(feature = "gen_future", issue = "50547")] #[inline] -#[cfg_attr(bootstrap, lang = "identity_future")] pub const fn identity_future<O, Fut: Future<Output = O>>(f: Fut) -> Fut { f } diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs index b14c801f2fb..79bd0bbb0c1 100644 --- a/library/core/src/intrinsics.rs +++ b/library/core/src/intrinsics.rs @@ -1823,14 +1823,12 @@ extern "rust-intrinsic" { /// with an even least significant digit. /// /// This intrinsic does not have a stable counterpart. - #[cfg(not(bootstrap))] #[rustc_nounwind] pub fn roundevenf32(x: f32) -> f32; /// Returns the nearest integer to an `f64`. Rounds half-way cases to the number /// with an even least significant digit. /// /// This intrinsic does not have a stable counterpart. - #[cfg(not(bootstrap))] #[rustc_nounwind] pub fn roundevenf64(x: f64) -> f64; @@ -2262,7 +2260,6 @@ extern "rust-intrinsic" { /// This intrinsic can *only* be called where the argument is a local without /// projections (`read_via_copy(p)`, not `read_via_copy(*p)`) so that it /// trivially obeys runtime-MIR rules about derefs in operands. - #[cfg(not(bootstrap))] #[rustc_const_unstable(feature = "const_ptr_read", issue = "80377")] #[rustc_nounwind] pub fn read_via_copy<T>(p: *const T) -> T; @@ -2470,7 +2467,6 @@ extern "rust-intrinsic" { /// This method creates a pointer to any `Some` value. If the argument is /// `None`, an invalid within-bounds pointer (that is still acceptable for /// constructing an empty slice) is returned. - #[cfg(not(bootstrap))] #[rustc_nounwind] pub fn option_payload_ptr<T>(arg: *const Option<T>) -> *const T; } diff --git a/library/core/src/iter/adapters/chain.rs b/library/core/src/iter/adapters/chain.rs index 2046b70c9c6..75727c3a240 100644 --- a/library/core/src/iter/adapters/chain.rs +++ b/library/core/src/iter/adapters/chain.rs @@ -273,7 +273,7 @@ where { } -#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")] +#[stable(feature = "default_iters", since = "1.70.0")] impl<A: Default, B: Default> Default for Chain<A, B> { /// Creates a `Chain` from the default values for `A` and `B`. /// diff --git a/library/core/src/iter/adapters/cloned.rs b/library/core/src/iter/adapters/cloned.rs index bb7e1660c6e..d3cceb8d4ad 100644 --- a/library/core/src/iter/adapters/cloned.rs +++ b/library/core/src/iter/adapters/cloned.rs @@ -154,7 +154,7 @@ where } } -#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")] +#[stable(feature = "default_iters", since = "1.70.0")] impl<I: Default> Default for Cloned<I> { /// Creates a `Cloned` iterator from the default value of `I` /// ``` diff --git a/library/core/src/iter/adapters/copied.rs b/library/core/src/iter/adapters/copied.rs index 2289025d0a7..8f6b2904eae 100644 --- a/library/core/src/iter/adapters/copied.rs +++ b/library/core/src/iter/adapters/copied.rs @@ -242,7 +242,7 @@ where } } -#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")] +#[stable(feature = "default_iters", since = "1.70.0")] impl<I: Default> Default for Copied<I> { /// Creates a `Copied` iterator from the default value of `I` /// ``` diff --git a/library/core/src/iter/adapters/enumerate.rs b/library/core/src/iter/adapters/enumerate.rs index 479ea6d83c7..00c1c377bf9 100644 --- a/library/core/src/iter/adapters/enumerate.rs +++ b/library/core/src/iter/adapters/enumerate.rs @@ -263,7 +263,7 @@ where #[unstable(issue = "none", feature = "inplace_iteration")] unsafe impl<I: InPlaceIterable> InPlaceIterable for Enumerate<I> {} -#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")] +#[stable(feature = "default_iters", since = "1.70.0")] impl<I: Default> Default for Enumerate<I> { /// Creates an `Enumerate` iterator from the default value of `I` /// ``` diff --git a/library/core/src/iter/adapters/flatten.rs b/library/core/src/iter/adapters/flatten.rs index 7217e8f2a8e..520ec9abcf0 100644 --- a/library/core/src/iter/adapters/flatten.rs +++ b/library/core/src/iter/adapters/flatten.rs @@ -289,7 +289,7 @@ where { } -#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")] +#[stable(feature = "default_iters", since = "1.70.0")] impl<I> Default for Flatten<I> where I: Default + Iterator<Item: IntoIterator>, diff --git a/library/core/src/iter/adapters/fuse.rs b/library/core/src/iter/adapters/fuse.rs index de91c188eeb..b1fa4f92117 100644 --- a/library/core/src/iter/adapters/fuse.rs +++ b/library/core/src/iter/adapters/fuse.rs @@ -181,7 +181,7 @@ where } } -#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")] +#[stable(feature = "default_iters", since = "1.70.0")] impl<I: Default> Default for Fuse<I> { /// Creates a `Fuse` iterator from the default value of `I`. /// diff --git a/library/core/src/iter/adapters/rev.rs b/library/core/src/iter/adapters/rev.rs index 1d882087f69..4aaf7c61f50 100644 --- a/library/core/src/iter/adapters/rev.rs +++ b/library/core/src/iter/adapters/rev.rs @@ -137,7 +137,7 @@ impl<I> FusedIterator for Rev<I> where I: FusedIterator + DoubleEndedIterator {} #[unstable(feature = "trusted_len", issue = "37572")] unsafe impl<I> TrustedLen for Rev<I> where I: TrustedLen + DoubleEndedIterator {} -#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")] +#[stable(feature = "default_iters", since = "1.70.0")] impl<I: Default> Default for Rev<I> { /// Creates a `Rev` iterator from the default value of `I` /// ``` diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index e85c0c0a688..40789cb3049 100644 --- a/library/core/src/marker.rs +++ b/library/core/src/marker.rs @@ -929,7 +929,6 @@ mod copy_impls { reason = "internal trait for implementing various traits for all function pointers" )] #[lang = "fn_ptr_trait"] -#[cfg(not(bootstrap))] #[rustc_deny_explicit_impl] pub trait FnPtr: Copy + Clone { /// Returns the address of the function pointer. diff --git a/library/core/src/num/nonzero.rs b/library/core/src/num/nonzero.rs index fc9b07d29e2..b80bfe1c92d 100644 --- a/library/core/src/num/nonzero.rs +++ b/library/core/src/num/nonzero.rs @@ -1162,7 +1162,7 @@ macro_rules! nonzero_min_max_unsigned { #[doc = concat!("# use std::num::", stringify!($Ty), ";")] #[doc = concat!("assert_eq!(", stringify!($Ty), "::MIN.get(), 1", stringify!($Int), ");")] /// ``` - #[stable(feature = "nonzero_min_max", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "nonzero_min_max", since = "1.70.0")] pub const MIN: Self = Self::new(1).unwrap(); /// The largest value that can be represented by this non-zero @@ -1175,7 +1175,7 @@ macro_rules! nonzero_min_max_unsigned { #[doc = concat!("# use std::num::", stringify!($Ty), ";")] #[doc = concat!("assert_eq!(", stringify!($Ty), "::MAX.get(), ", stringify!($Int), "::MAX);")] /// ``` - #[stable(feature = "nonzero_min_max", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "nonzero_min_max", since = "1.70.0")] pub const MAX: Self = Self::new(<$Int>::MAX).unwrap(); } )+ @@ -1200,7 +1200,7 @@ macro_rules! nonzero_min_max_signed { #[doc = concat!("# use std::num::", stringify!($Ty), ";")] #[doc = concat!("assert_eq!(", stringify!($Ty), "::MIN.get(), ", stringify!($Int), "::MIN);")] /// ``` - #[stable(feature = "nonzero_min_max", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "nonzero_min_max", since = "1.70.0")] pub const MIN: Self = Self::new(<$Int>::MIN).unwrap(); /// The largest value that can be represented by this non-zero @@ -1217,7 +1217,7 @@ macro_rules! nonzero_min_max_signed { #[doc = concat!("# use std::num::", stringify!($Ty), ";")] #[doc = concat!("assert_eq!(", stringify!($Ty), "::MAX.get(), ", stringify!($Int), "::MAX);")] /// ``` - #[stable(feature = "nonzero_min_max", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "nonzero_min_max", since = "1.70.0")] pub const MAX: Self = Self::new(<$Int>::MAX).unwrap(); } )+ diff --git a/library/core/src/option.rs b/library/core/src/option.rs index 82e7e69215e..73ffc3f36ca 100644 --- a/library/core/src/option.rs +++ b/library/core/src/option.rs @@ -558,7 +558,7 @@ use crate::{ /// The `Option` type. See [the module level documentation](self) for more. #[derive(Copy, PartialOrd, Eq, Ord, Debug, Hash)] #[rustc_diagnostic_item = "Option"] -#[cfg_attr(not(bootstrap), lang = "Option")] +#[lang = "Option"] #[stable(feature = "rust1", since = "1.0.0")] pub enum Option<T> { /// No value. @@ -615,7 +615,7 @@ impl<T> Option<T> { /// ``` #[must_use] #[inline] - #[stable(feature = "is_some_and", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "is_some_and", since = "1.70.0")] pub fn is_some_and(self, f: impl FnOnce(T) -> bool) -> bool { match self { None => false, @@ -765,13 +765,6 @@ impl<T> Option<T> { #[must_use] #[unstable(feature = "option_as_slice", issue = "108545")] pub fn as_slice(&self) -> &[T] { - #[cfg(bootstrap)] - match self { - Some(value) => slice::from_ref(value), - None => &[], - } - - #[cfg(not(bootstrap))] // SAFETY: When the `Option` is `Some`, we're using the actual pointer // to the payload, with a length of 1, so this is equivalent to // `slice::from_ref`, and thus is safe. @@ -832,13 +825,6 @@ impl<T> Option<T> { #[must_use] #[unstable(feature = "option_as_slice", issue = "108545")] pub fn as_mut_slice(&mut self) -> &mut [T] { - #[cfg(bootstrap)] - match self { - Some(value) => slice::from_mut(value), - None => &mut [], - } - - #[cfg(not(bootstrap))] // SAFETY: When the `Option` is `Some`, we're using the actual pointer // to the payload, with a length of 1, so this is equivalent to // `slice::from_mut`, and thus is safe. diff --git a/library/core/src/panicking.rs b/library/core/src/panicking.rs index efeb726ab8e..81be3fb22ee 100644 --- a/library/core/src/panicking.rs +++ b/library/core/src/panicking.rs @@ -165,7 +165,7 @@ fn panic_bounds_check(index: usize, len: usize) -> ! { #[cold] #[cfg_attr(not(feature = "panic_immediate_abort"), inline(never))] #[track_caller] -#[cfg_attr(not(bootstrap), lang = "panic_misaligned_pointer_dereference")] // needed by codegen for panic on misaligned pointer deref +#[lang = "panic_misaligned_pointer_dereference"] // needed by codegen for panic on misaligned pointer deref fn panic_misaligned_pointer_dereference(required: usize, found: usize) -> ! { if cfg!(feature = "panic_immediate_abort") { super::intrinsics::abort() diff --git a/library/core/src/primitive_docs.rs b/library/core/src/primitive_docs.rs index 3df990e5dd9..08ffc407ead 100644 --- a/library/core/src/primitive_docs.rs +++ b/library/core/src/primitive_docs.rs @@ -1,8 +1,7 @@ // `library/{std,core}/src/primitive_docs.rs` should have the same contents. // These are different files so that relative links work properly without // having to have `CARGO_PKG_NAME` set, but conceptually they should always be the same. -#[cfg_attr(bootstrap, doc(primitive = "bool"))] -#[cfg_attr(not(bootstrap), rustc_doc_primitive = "bool")] +#[rustc_doc_primitive = "bool"] #[doc(alias = "true")] #[doc(alias = "false")] /// The boolean type. @@ -64,8 +63,7 @@ #[stable(feature = "rust1", since = "1.0.0")] mod prim_bool {} -#[cfg_attr(bootstrap, doc(primitive = "never"))] -#[cfg_attr(not(bootstrap), rustc_doc_primitive = "never")] +#[rustc_doc_primitive = "never"] #[doc(alias = "!")] // /// The `!` type, also called "never". @@ -276,8 +274,7 @@ mod prim_bool {} #[unstable(feature = "never_type", issue = "35121")] mod prim_never {} -#[cfg_attr(bootstrap, doc(primitive = "char"))] -#[cfg_attr(not(bootstrap), rustc_doc_primitive = "char")] +#[rustc_doc_primitive = "char"] #[allow(rustdoc::invalid_rust_codeblocks)] /// A character type. /// @@ -401,8 +398,7 @@ mod prim_never {} #[stable(feature = "rust1", since = "1.0.0")] mod prim_char {} -#[cfg_attr(bootstrap, doc(primitive = "unit"))] -#[cfg_attr(not(bootstrap), rustc_doc_primitive = "unit")] +#[rustc_doc_primitive = "unit"] #[doc(alias = "(")] #[doc(alias = ")")] #[doc(alias = "()")] @@ -464,8 +460,7 @@ impl Copy for () { // empty } -#[cfg_attr(bootstrap, doc(primitive = "pointer"))] -#[cfg_attr(not(bootstrap), rustc_doc_primitive = "pointer")] +#[rustc_doc_primitive = "pointer"] #[doc(alias = "ptr")] #[doc(alias = "*")] #[doc(alias = "*const")] @@ -581,8 +576,7 @@ impl Copy for () { #[stable(feature = "rust1", since = "1.0.0")] mod prim_pointer {} -#[cfg_attr(bootstrap, doc(primitive = "array"))] -#[cfg_attr(not(bootstrap), rustc_doc_primitive = "array")] +#[rustc_doc_primitive = "array"] #[doc(alias = "[]")] #[doc(alias = "[T;N]")] // unfortunately, rustdoc doesn't have fuzzy search for aliases #[doc(alias = "[T; N]")] @@ -783,8 +777,7 @@ mod prim_pointer {} #[stable(feature = "rust1", since = "1.0.0")] mod prim_array {} -#[cfg_attr(bootstrap, doc(primitive = "slice"))] -#[cfg_attr(not(bootstrap), rustc_doc_primitive = "slice")] +#[rustc_doc_primitive = "slice"] #[doc(alias = "[")] #[doc(alias = "]")] #[doc(alias = "[]")] @@ -876,8 +869,7 @@ mod prim_array {} #[stable(feature = "rust1", since = "1.0.0")] mod prim_slice {} -#[cfg_attr(bootstrap, doc(primitive = "str"))] -#[cfg_attr(not(bootstrap), rustc_doc_primitive = "str")] +#[rustc_doc_primitive = "str"] /// String slices. /// /// *[See also the `std::str` module](crate::str).* @@ -944,8 +936,7 @@ mod prim_slice {} #[stable(feature = "rust1", since = "1.0.0")] mod prim_str {} -#[cfg_attr(bootstrap, doc(primitive = "tuple"))] -#[cfg_attr(not(bootstrap), rustc_doc_primitive = "tuple")] +#[rustc_doc_primitive = "tuple"] #[doc(alias = "(")] #[doc(alias = ")")] #[doc(alias = "()")] @@ -1088,8 +1079,7 @@ impl<T: Copy> Copy for (T,) { // empty } -#[cfg_attr(bootstrap, doc(primitive = "f32"))] -#[cfg_attr(not(bootstrap), rustc_doc_primitive = "f32")] +#[rustc_doc_primitive = "f32"] /// A 32-bit floating point type (specifically, the "binary32" type defined in IEEE 754-2008). /// /// This type can represent a wide range of decimal numbers, like `3.5`, `27`, @@ -1155,8 +1145,7 @@ impl<T: Copy> Copy for (T,) { #[stable(feature = "rust1", since = "1.0.0")] mod prim_f32 {} -#[cfg_attr(bootstrap, doc(primitive = "f64"))] -#[cfg_attr(not(bootstrap), rustc_doc_primitive = "f64")] +#[rustc_doc_primitive = "f64"] /// A 64-bit floating point type (specifically, the "binary64" type defined in IEEE 754-2008). /// /// This type is very similar to [`f32`], but has increased @@ -1171,78 +1160,67 @@ mod prim_f32 {} #[stable(feature = "rust1", since = "1.0.0")] mod prim_f64 {} -#[cfg_attr(bootstrap, doc(primitive = "i8"))] -#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i8")] +#[rustc_doc_primitive = "i8"] // /// The 8-bit signed integer type. #[stable(feature = "rust1", since = "1.0.0")] mod prim_i8 {} -#[cfg_attr(bootstrap, doc(primitive = "i16"))] -#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i16")] +#[rustc_doc_primitive = "i16"] // /// The 16-bit signed integer type. #[stable(feature = "rust1", since = "1.0.0")] mod prim_i16 {} -#[cfg_attr(bootstrap, doc(primitive = "i32"))] -#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i32")] +#[rustc_doc_primitive = "i32"] // /// The 32-bit signed integer type. #[stable(feature = "rust1", since = "1.0.0")] mod prim_i32 {} -#[cfg_attr(bootstrap, doc(primitive = "i64"))] -#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i64")] +#[rustc_doc_primitive = "i64"] // /// The 64-bit signed integer type. #[stable(feature = "rust1", since = "1.0.0")] mod prim_i64 {} -#[cfg_attr(bootstrap, doc(primitive = "i128"))] -#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i128")] +#[rustc_doc_primitive = "i128"] // /// The 128-bit signed integer type. #[stable(feature = "i128", since = "1.26.0")] mod prim_i128 {} -#[cfg_attr(bootstrap, doc(primitive = "u8"))] -#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u8")] +#[rustc_doc_primitive = "u8"] // /// The 8-bit unsigned integer type. #[stable(feature = "rust1", since = "1.0.0")] mod prim_u8 {} -#[cfg_attr(bootstrap, doc(primitive = "u16"))] -#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u16")] +#[rustc_doc_primitive = "u16"] // /// The 16-bit unsigned integer type. #[stable(feature = "rust1", since = "1.0.0")] mod prim_u16 {} -#[cfg_attr(bootstrap, doc(primitive = "u32"))] -#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u32")] +#[rustc_doc_primitive = "u32"] // /// The 32-bit unsigned integer type. #[stable(feature = "rust1", since = "1.0.0")] mod prim_u32 {} -#[cfg_attr(bootstrap, doc(primitive = "u64"))] -#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u64")] +#[rustc_doc_primitive = "u64"] // /// The 64-bit unsigned integer type. #[stable(feature = "rust1", since = "1.0.0")] mod prim_u64 {} -#[cfg_attr(bootstrap, doc(primitive = "u128"))] -#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u128")] +#[rustc_doc_primitive = "u128"] // /// The 128-bit unsigned integer type. #[stable(feature = "i128", since = "1.26.0")] mod prim_u128 {} -#[cfg_attr(bootstrap, doc(primitive = "isize"))] -#[cfg_attr(not(bootstrap), rustc_doc_primitive = "isize")] +#[rustc_doc_primitive = "isize"] // /// The pointer-sized signed integer type. /// @@ -1252,8 +1230,7 @@ mod prim_u128 {} #[stable(feature = "rust1", since = "1.0.0")] mod prim_isize {} -#[cfg_attr(bootstrap, doc(primitive = "usize"))] -#[cfg_attr(not(bootstrap), rustc_doc_primitive = "usize")] +#[rustc_doc_primitive = "usize"] // /// The pointer-sized unsigned integer type. /// @@ -1263,8 +1240,7 @@ mod prim_isize {} #[stable(feature = "rust1", since = "1.0.0")] mod prim_usize {} -#[cfg_attr(bootstrap, doc(primitive = "reference"))] -#[cfg_attr(not(bootstrap), rustc_doc_primitive = "reference")] +#[rustc_doc_primitive = "reference"] #[doc(alias = "&")] #[doc(alias = "&mut")] // @@ -1396,8 +1372,7 @@ mod prim_usize {} #[stable(feature = "rust1", since = "1.0.0")] mod prim_ref {} -#[cfg_attr(bootstrap, doc(primitive = "fn"))] -#[cfg_attr(not(bootstrap), rustc_doc_primitive = "fn")] +#[rustc_doc_primitive = "fn"] // /// Function pointers, like `fn(usize) -> bool`. /// diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index 675bc8245d8..13e546497f2 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/core/src/ptr/mod.rs @@ -374,6 +374,7 @@ use crate::hash; use crate::intrinsics::{ self, assert_unsafe_precondition, is_aligned_and_not_null, is_nonoverlapping, }; +use crate::marker::FnPtr; use crate::mem::{self, MaybeUninit}; @@ -1167,26 +1168,7 @@ pub const unsafe fn read<T>(src: *const T) -> T { "ptr::read requires that the pointer argument is aligned and non-null", [T](src: *const T) => is_aligned_and_not_null(src) ); - - #[cfg(bootstrap)] - { - // We are calling the intrinsics directly to avoid function calls in the - // generated code as `intrinsics::copy_nonoverlapping` is a wrapper function. - extern "rust-intrinsic" { - #[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")] - fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize); - } - - // `src` cannot overlap `tmp` because `tmp` was just allocated on - // the stack as a separate allocated object. - let mut tmp = MaybeUninit::<T>::uninit(); - copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); - tmp.assume_init() - } - #[cfg(not(bootstrap))] - { - crate::intrinsics::read_via_copy(src) - } + crate::intrinsics::read_via_copy(src) } } @@ -1897,205 +1879,52 @@ pub fn hash<T: ?Sized, S: hash::Hasher>(hashee: *const T, into: &mut S) { hashee.hash(into); } -#[cfg(bootstrap)] -mod old_fn_ptr_impl { - use super::*; - // If this is a unary fn pointer, it adds a doc comment. - // Otherwise, it hides the docs entirely. - macro_rules! maybe_fnptr_doc { - (@ #[$meta:meta] $item:item) => { - #[doc(hidden)] - #[$meta] - $item - }; - ($a:ident @ #[$meta:meta] $item:item) => { - #[doc(fake_variadic)] - #[doc = "This trait is implemented for function pointers with up to twelve arguments."] - #[$meta] - $item - }; - ($a:ident $($rest_a:ident)+ @ #[$meta:meta] $item:item) => { - #[doc(hidden)] - #[$meta] - $item - }; - } - - // FIXME(strict_provenance_magic): function pointers have buggy codegen that - // necessitates casting to a usize to get the backend to do the right thing. - // for now I will break AVR to silence *a billion* lints. We should probably - // have a proper "opaque function pointer type" to handle this kind of thing. - - // Impls for function pointers - macro_rules! fnptr_impls_safety_abi { - ($FnTy: ty, $($Arg: ident),*) => { - fnptr_impls_safety_abi! { #[stable(feature = "fnptr_impls", since = "1.4.0")] $FnTy, $($Arg),* } - }; - (@c_unwind $FnTy: ty, $($Arg: ident),*) => { - fnptr_impls_safety_abi! { #[unstable(feature = "c_unwind", issue = "74990")] $FnTy, $($Arg),* } - }; - (#[$meta:meta] $FnTy: ty, $($Arg: ident),*) => { - maybe_fnptr_doc! { - $($Arg)* @ - #[$meta] - impl<Ret, $($Arg),*> PartialEq for $FnTy { - #[inline] - fn eq(&self, other: &Self) -> bool { - *self as usize == *other as usize - } - } - } - - maybe_fnptr_doc! { - $($Arg)* @ - #[$meta] - impl<Ret, $($Arg),*> Eq for $FnTy {} - } - - maybe_fnptr_doc! { - $($Arg)* @ - #[$meta] - impl<Ret, $($Arg),*> PartialOrd for $FnTy { - #[inline] - fn partial_cmp(&self, other: &Self) -> Option<Ordering> { - (*self as usize).partial_cmp(&(*other as usize)) - } - } - } - - maybe_fnptr_doc! { - $($Arg)* @ - #[$meta] - impl<Ret, $($Arg),*> Ord for $FnTy { - #[inline] - fn cmp(&self, other: &Self) -> Ordering { - (*self as usize).cmp(&(*other as usize)) - } - } - } - - maybe_fnptr_doc! { - $($Arg)* @ - #[$meta] - impl<Ret, $($Arg),*> hash::Hash for $FnTy { - fn hash<HH: hash::Hasher>(&self, state: &mut HH) { - state.write_usize(*self as usize) - } - } - } - - maybe_fnptr_doc! { - $($Arg)* @ - #[$meta] - impl<Ret, $($Arg),*> fmt::Pointer for $FnTy { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt::pointer_fmt_inner(*self as usize, f) - } - } - } - - maybe_fnptr_doc! { - $($Arg)* @ - #[$meta] - impl<Ret, $($Arg),*> fmt::Debug for $FnTy { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt::pointer_fmt_inner(*self as usize, f) - } - } - } - } - } - - macro_rules! fnptr_impls_args { - ($($Arg: ident),+) => { - fnptr_impls_safety_abi! { extern "Rust" fn($($Arg),+) -> Ret, $($Arg),+ } - fnptr_impls_safety_abi! { extern "C" fn($($Arg),+) -> Ret, $($Arg),+ } - fnptr_impls_safety_abi! { extern "C" fn($($Arg),+ , ...) -> Ret, $($Arg),+ } - fnptr_impls_safety_abi! { @c_unwind extern "C-unwind" fn($($Arg),+) -> Ret, $($Arg),+ } - fnptr_impls_safety_abi! { @c_unwind extern "C-unwind" fn($($Arg),+ , ...) -> Ret, $($Arg),+ } - fnptr_impls_safety_abi! { unsafe extern "Rust" fn($($Arg),+) -> Ret, $($Arg),+ } - fnptr_impls_safety_abi! { unsafe extern "C" fn($($Arg),+) -> Ret, $($Arg),+ } - fnptr_impls_safety_abi! { unsafe extern "C" fn($($Arg),+ , ...) -> Ret, $($Arg),+ } - fnptr_impls_safety_abi! { @c_unwind unsafe extern "C-unwind" fn($($Arg),+) -> Ret, $($Arg),+ } - fnptr_impls_safety_abi! { @c_unwind unsafe extern "C-unwind" fn($($Arg),+ , ...) -> Ret, $($Arg),+ } - }; - () => { - // No variadic functions with 0 parameters - fnptr_impls_safety_abi! { extern "Rust" fn() -> Ret, } - fnptr_impls_safety_abi! { extern "C" fn() -> Ret, } - fnptr_impls_safety_abi! { @c_unwind extern "C-unwind" fn() -> Ret, } - fnptr_impls_safety_abi! { unsafe extern "Rust" fn() -> Ret, } - fnptr_impls_safety_abi! { unsafe extern "C" fn() -> Ret, } - fnptr_impls_safety_abi! { @c_unwind unsafe extern "C-unwind" fn() -> Ret, } - }; +#[stable(feature = "fnptr_impls", since = "1.4.0")] +impl<F: FnPtr> PartialEq for F { + #[inline] + fn eq(&self, other: &Self) -> bool { + self.addr() == other.addr() } - - fnptr_impls_args! {} - fnptr_impls_args! { T } - fnptr_impls_args! { A, B } - fnptr_impls_args! { A, B, C } - fnptr_impls_args! { A, B, C, D } - fnptr_impls_args! { A, B, C, D, E } - fnptr_impls_args! { A, B, C, D, E, F } - fnptr_impls_args! { A, B, C, D, E, F, G } - fnptr_impls_args! { A, B, C, D, E, F, G, H } - fnptr_impls_args! { A, B, C, D, E, F, G, H, I } - fnptr_impls_args! { A, B, C, D, E, F, G, H, I, J } - fnptr_impls_args! { A, B, C, D, E, F, G, H, I, J, K } - fnptr_impls_args! { A, B, C, D, E, F, G, H, I, J, K, L } } +#[stable(feature = "fnptr_impls", since = "1.4.0")] +impl<F: FnPtr> Eq for F {} -#[cfg(not(bootstrap))] -mod new_fn_ptr_impl { - use super::*; - use crate::marker::FnPtr; - - #[stable(feature = "fnptr_impls", since = "1.4.0")] - impl<F: FnPtr> PartialEq for F { - #[inline] - fn eq(&self, other: &Self) -> bool { - self.addr() == other.addr() - } - } - #[stable(feature = "fnptr_impls", since = "1.4.0")] - impl<F: FnPtr> Eq for F {} - - #[stable(feature = "fnptr_impls", since = "1.4.0")] - impl<F: FnPtr> PartialOrd for F { - #[inline] - fn partial_cmp(&self, other: &Self) -> Option<Ordering> { - self.addr().partial_cmp(&other.addr()) - } +#[stable(feature = "fnptr_impls", since = "1.4.0")] +impl<F: FnPtr> PartialOrd for F { + #[inline] + fn partial_cmp(&self, other: &Self) -> Option<Ordering> { + self.addr().partial_cmp(&other.addr()) } - #[stable(feature = "fnptr_impls", since = "1.4.0")] - impl<F: FnPtr> Ord for F { - #[inline] - fn cmp(&self, other: &Self) -> Ordering { - self.addr().cmp(&other.addr()) - } +} +#[stable(feature = "fnptr_impls", since = "1.4.0")] +impl<F: FnPtr> Ord for F { + #[inline] + fn cmp(&self, other: &Self) -> Ordering { + self.addr().cmp(&other.addr()) } +} - #[stable(feature = "fnptr_impls", since = "1.4.0")] - impl<F: FnPtr> hash::Hash for F { - fn hash<HH: hash::Hasher>(&self, state: &mut HH) { - state.write_usize(self.addr() as _) - } +#[stable(feature = "fnptr_impls", since = "1.4.0")] +impl<F: FnPtr> hash::Hash for F { + fn hash<HH: hash::Hasher>(&self, state: &mut HH) { + state.write_usize(self.addr() as _) } +} - #[stable(feature = "fnptr_impls", since = "1.4.0")] - impl<F: FnPtr> fmt::Pointer for F { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt::pointer_fmt_inner(self.addr() as _, f) - } +#[stable(feature = "fnptr_impls", since = "1.4.0")] +impl<F: FnPtr> fmt::Pointer for F { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + fmt::pointer_fmt_inner(self.addr() as _, f) } +} - #[stable(feature = "fnptr_impls", since = "1.4.0")] - impl<F: FnPtr> fmt::Debug for F { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt::pointer_fmt_inner(self.addr() as _, f) - } +#[stable(feature = "fnptr_impls", since = "1.4.0")] +impl<F: FnPtr> fmt::Debug for F { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + fmt::pointer_fmt_inner(self.addr() as _, f) } } + /// Create a `const` raw pointer to a place, without creating an intermediate reference. /// /// Creating a reference with `&`/`&mut` is only allowed if the pointer is properly aligned diff --git a/library/core/src/ptr/non_null.rs b/library/core/src/ptr/non_null.rs index 506d891d989..61fcdf58b4f 100644 --- a/library/core/src/ptr/non_null.rs +++ b/library/core/src/ptr/non_null.rs @@ -473,7 +473,7 @@ impl<T> NonNull<[T]> { /// /// (Note that this example artificially demonstrates a use of this method, /// but `let slice = NonNull::from(&x[..]);` would be a better way to write code like this.) - #[stable(feature = "nonnull_slice_from_raw_parts", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "nonnull_slice_from_raw_parts", since = "1.70.0")] #[rustc_const_unstable(feature = "const_slice_from_raw_parts_mut", issue = "67456")] #[must_use] #[inline] diff --git a/library/core/src/result.rs b/library/core/src/result.rs index 28cb02989ec..1ee270f4c03 100644 --- a/library/core/src/result.rs +++ b/library/core/src/result.rs @@ -555,7 +555,7 @@ impl<T, E> Result<T, E> { /// ``` #[must_use] #[inline] - #[stable(feature = "is_some_and", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "is_some_and", since = "1.70.0")] pub fn is_ok_and(self, f: impl FnOnce(T) -> bool) -> bool { match self { Err(_) => false, @@ -600,7 +600,7 @@ impl<T, E> Result<T, E> { /// ``` #[must_use] #[inline] - #[stable(feature = "is_some_and", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "is_some_and", since = "1.70.0")] pub fn is_err_and(self, f: impl FnOnce(E) -> bool) -> bool { match self { Ok(_) => false, diff --git a/library/core/src/slice/iter/macros.rs b/library/core/src/slice/iter/macros.rs index b1ca872b845..0a30033778b 100644 --- a/library/core/src/slice/iter/macros.rs +++ b/library/core/src/slice/iter/macros.rs @@ -394,7 +394,7 @@ macro_rules! iterator { } } - #[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "default_iters", since = "1.70.0")] impl<T> Default for $name<'_, T> { /// Creates an empty slice iterator. /// diff --git a/library/core/src/sync/atomic.rs b/library/core/src/sync/atomic.rs index b0ab634905f..236b7f423d6 100644 --- a/library/core/src/sync/atomic.rs +++ b/library/core/src/sync/atomic.rs @@ -970,8 +970,8 @@ impl AtomicBool { /// # } /// ``` #[inline] - #[stable(feature = "atomic_as_ptr", since = "CURRENT_RUSTC_VERSION")] - #[rustc_const_stable(feature = "atomic_as_ptr", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "atomic_as_ptr", since = "1.70.0")] + #[rustc_const_stable(feature = "atomic_as_ptr", since = "1.70.0")] pub const fn as_ptr(&self) -> *mut bool { self.v.get().cast() } @@ -1905,8 +1905,8 @@ impl<T> AtomicPtr<T> { /// } /// ``` #[inline] - #[stable(feature = "atomic_as_ptr", since = "CURRENT_RUSTC_VERSION")] - #[rustc_const_stable(feature = "atomic_as_ptr", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "atomic_as_ptr", since = "1.70.0")] + #[rustc_const_stable(feature = "atomic_as_ptr", since = "1.70.0")] pub const fn as_ptr(&self) -> *mut *mut T { self.p.get() } @@ -2854,8 +2854,8 @@ macro_rules! atomic_int { /// # } /// ``` #[inline] - #[stable(feature = "atomic_as_ptr", since = "CURRENT_RUSTC_VERSION")] - #[rustc_const_stable(feature = "atomic_as_ptr", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "atomic_as_ptr", since = "1.70.0")] + #[rustc_const_stable(feature = "atomic_as_ptr", since = "1.70.0")] pub const fn as_ptr(&self) -> *mut $int_type { self.v.get() } |
