diff --git a/library/core/src/fmt/mod.rs b/library/core/src/fmt/mod.rs index f4f3223257047..e193332f155be 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 04f02d47f92cb..7a8d0cacdece5 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>(f: Fut) -> Fut { f } diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs index b14c801f2fb72..79bd0bbb0c19d 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(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(arg: *const Option) -> *const T; } diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index e85c0c0a68890..40789cb3049de 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/option.rs b/library/core/src/option.rs index ac3fcb3e38245..73ffc3f36ca75 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 { /// No value. @@ -765,13 +765,6 @@ impl Option { #[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 Option { #[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 efeb726ab8eb8..81be3fb22eec4 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 3df990e5dd9fe..08ffc407eadb1 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 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 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 675bc8245d8d8..13e546497f27d 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(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(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::::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(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 PartialEq for $FnTy { - #[inline] - fn eq(&self, other: &Self) -> bool { - *self as usize == *other as usize - } - } - } - - maybe_fnptr_doc! { - $($Arg)* @ - #[$meta] - impl Eq for $FnTy {} - } - - maybe_fnptr_doc! { - $($Arg)* @ - #[$meta] - impl PartialOrd for $FnTy { - #[inline] - fn partial_cmp(&self, other: &Self) -> Option { - (*self as usize).partial_cmp(&(*other as usize)) - } - } - } - - maybe_fnptr_doc! { - $($Arg)* @ - #[$meta] - impl Ord for $FnTy { - #[inline] - fn cmp(&self, other: &Self) -> Ordering { - (*self as usize).cmp(&(*other as usize)) - } - } - } - - maybe_fnptr_doc! { - $($Arg)* @ - #[$meta] - impl hash::Hash for $FnTy { - fn hash(&self, state: &mut HH) { - state.write_usize(*self as usize) - } - } - } - - maybe_fnptr_doc! { - $($Arg)* @ - #[$meta] - impl 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 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 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 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 PartialEq for F { - #[inline] - fn eq(&self, other: &Self) -> bool { - self.addr() == other.addr() - } - } - #[stable(feature = "fnptr_impls", since = "1.4.0")] - impl Eq for F {} - - #[stable(feature = "fnptr_impls", since = "1.4.0")] - impl PartialOrd for F { - #[inline] - fn partial_cmp(&self, other: &Self) -> Option { - self.addr().partial_cmp(&other.addr()) - } +#[stable(feature = "fnptr_impls", since = "1.4.0")] +impl PartialOrd for F { + #[inline] + fn partial_cmp(&self, other: &Self) -> Option { + self.addr().partial_cmp(&other.addr()) } - #[stable(feature = "fnptr_impls", since = "1.4.0")] - impl Ord for F { - #[inline] - fn cmp(&self, other: &Self) -> Ordering { - self.addr().cmp(&other.addr()) - } +} +#[stable(feature = "fnptr_impls", since = "1.4.0")] +impl Ord for F { + #[inline] + fn cmp(&self, other: &Self) -> Ordering { + self.addr().cmp(&other.addr()) } +} - #[stable(feature = "fnptr_impls", since = "1.4.0")] - impl hash::Hash for F { - fn hash(&self, state: &mut HH) { - state.write_usize(self.addr() as _) - } +#[stable(feature = "fnptr_impls", since = "1.4.0")] +impl hash::Hash for F { + fn hash(&self, state: &mut HH) { + state.write_usize(self.addr() as _) } +} - #[stable(feature = "fnptr_impls", since = "1.4.0")] - impl 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 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 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 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/std/src/primitive_docs.rs b/library/std/src/primitive_docs.rs index 3df990e5dd9fe..08ffc407eadb1 100644 --- a/library/std/src/primitive_docs.rs +++ b/library/std/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 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 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/std/src/sys/common/thread_local/fast_local.rs b/library/std/src/sys/common/thread_local/fast_local.rs index 914e017f7ffaf..447044a798ba6 100644 --- a/library/std/src/sys/common/thread_local/fast_local.rs +++ b/library/std/src/sys/common/thread_local/fast_local.rs @@ -11,7 +11,7 @@ use crate::{fmt, mem, panic}; pub macro thread_local_inner { // used to generate the `LocalKey` value for const-initialized thread locals (@key $t:ty, const $init:expr) => {{ - #[cfg_attr(not(bootstrap), inline)] + #[inline] #[deny(unsafe_op_in_unsafe_fn)] unsafe fn __getit( _init: $crate::option::Option<&mut $crate::option::Option<$t>>, @@ -78,7 +78,7 @@ pub macro thread_local_inner { #[inline] fn __init() -> $t { $init } - #[cfg_attr(not(bootstrap), inline)] + #[inline] unsafe fn __getit( init: $crate::option::Option<&mut $crate::option::Option<$t>>, ) -> $crate::option::Option<&'static $t> { diff --git a/library/std/src/sys/common/thread_local/os_local.rs b/library/std/src/sys/common/thread_local/os_local.rs index e9516f9983f2a..d004897df281a 100644 --- a/library/std/src/sys/common/thread_local/os_local.rs +++ b/library/std/src/sys/common/thread_local/os_local.rs @@ -11,7 +11,7 @@ use crate::{fmt, marker, panic, ptr}; pub macro thread_local_inner { // used to generate the `LocalKey` value for const-initialized thread locals (@key $t:ty, const $init:expr) => {{ - #[cfg_attr(not(bootstrap), inline)] + #[inline] #[deny(unsafe_op_in_unsafe_fn)] unsafe fn __getit( _init: $crate::option::Option<&mut $crate::option::Option<$t>>, diff --git a/library/test/src/formatters/json.rs b/library/test/src/formatters/json.rs index 40976ec5e1c8b..8572d1c20ce7e 100644 --- a/library/test/src/formatters/json.rs +++ b/library/test/src/formatters/json.rs @@ -69,30 +69,14 @@ impl OutputFormatter for JsonFormatter { name, ignore, ignore_message, - #[cfg(not(bootstrap))] source_file, - #[cfg(not(bootstrap))] start_line, - #[cfg(not(bootstrap))] start_col, - #[cfg(not(bootstrap))] end_line, - #[cfg(not(bootstrap))] end_col, .. } = desc; - #[cfg(bootstrap)] - let source_file = ""; - #[cfg(bootstrap)] - let start_line = 0; - #[cfg(bootstrap)] - let start_col = 0; - #[cfg(bootstrap)] - let end_line = 0; - #[cfg(bootstrap)] - let end_col = 0; - self.writeln_message(&format!( r#"{{ "type": "{test_type}", "event": "discovered", "name": "{}", "ignore": {ignore}, "ignore_message": "{}", "source_path": "{}", "start_line": {start_line}, "start_col": {start_col}, "end_line": {end_line}, "end_col": {end_col} }}"#, EscapedString(name.as_slice()), diff --git a/library/test/src/tests.rs b/library/test/src/tests.rs index 5ffdbf73fbf93..c34583e695974 100644 --- a/library/test/src/tests.rs +++ b/library/test/src/tests.rs @@ -63,15 +63,10 @@ fn one_ignored_one_unignored_test() -> Vec { name: StaticTestName("1"), ignore: true, ignore_message: None, - #[cfg(not(bootstrap))] source_file: "", - #[cfg(not(bootstrap))] start_line: 0, - #[cfg(not(bootstrap))] start_col: 0, - #[cfg(not(bootstrap))] end_line: 0, - #[cfg(not(bootstrap))] end_col: 0, should_panic: ShouldPanic::No, compile_fail: false, @@ -85,15 +80,10 @@ fn one_ignored_one_unignored_test() -> Vec { name: StaticTestName("2"), ignore: false, ignore_message: None, - #[cfg(not(bootstrap))] source_file: "", - #[cfg(not(bootstrap))] start_line: 0, - #[cfg(not(bootstrap))] start_col: 0, - #[cfg(not(bootstrap))] end_line: 0, - #[cfg(not(bootstrap))] end_col: 0, should_panic: ShouldPanic::No, compile_fail: false, @@ -115,15 +105,10 @@ pub fn do_not_run_ignored_tests() { name: StaticTestName("whatever"), ignore: true, ignore_message: None, - #[cfg(not(bootstrap))] source_file: "", - #[cfg(not(bootstrap))] start_line: 0, - #[cfg(not(bootstrap))] start_col: 0, - #[cfg(not(bootstrap))] end_line: 0, - #[cfg(not(bootstrap))] end_col: 0, should_panic: ShouldPanic::No, compile_fail: false, @@ -148,15 +133,10 @@ pub fn ignored_tests_result_in_ignored() { name: StaticTestName("whatever"), ignore: true, ignore_message: None, - #[cfg(not(bootstrap))] source_file: "", - #[cfg(not(bootstrap))] start_line: 0, - #[cfg(not(bootstrap))] start_col: 0, - #[cfg(not(bootstrap))] end_line: 0, - #[cfg(not(bootstrap))] end_col: 0, should_panic: ShouldPanic::No, compile_fail: false, @@ -183,15 +163,10 @@ fn test_should_panic() { name: StaticTestName("whatever"), ignore: false, ignore_message: None, - #[cfg(not(bootstrap))] source_file: "", - #[cfg(not(bootstrap))] start_line: 0, - #[cfg(not(bootstrap))] start_col: 0, - #[cfg(not(bootstrap))] end_line: 0, - #[cfg(not(bootstrap))] end_col: 0, should_panic: ShouldPanic::Yes, compile_fail: false, @@ -218,15 +193,10 @@ fn test_should_panic_good_message() { name: StaticTestName("whatever"), ignore: false, ignore_message: None, - #[cfg(not(bootstrap))] source_file: "", - #[cfg(not(bootstrap))] start_line: 0, - #[cfg(not(bootstrap))] start_col: 0, - #[cfg(not(bootstrap))] end_line: 0, - #[cfg(not(bootstrap))] end_col: 0, should_panic: ShouldPanic::YesWithMessage("error message"), compile_fail: false, @@ -258,15 +228,10 @@ fn test_should_panic_bad_message() { name: StaticTestName("whatever"), ignore: false, ignore_message: None, - #[cfg(not(bootstrap))] source_file: "", - #[cfg(not(bootstrap))] start_line: 0, - #[cfg(not(bootstrap))] start_col: 0, - #[cfg(not(bootstrap))] end_line: 0, - #[cfg(not(bootstrap))] end_col: 0, should_panic: ShouldPanic::YesWithMessage(expected), compile_fail: false, @@ -302,15 +267,10 @@ fn test_should_panic_non_string_message_type() { name: StaticTestName("whatever"), ignore: false, ignore_message: None, - #[cfg(not(bootstrap))] source_file: "", - #[cfg(not(bootstrap))] start_line: 0, - #[cfg(not(bootstrap))] start_col: 0, - #[cfg(not(bootstrap))] end_line: 0, - #[cfg(not(bootstrap))] end_col: 0, should_panic: ShouldPanic::YesWithMessage(expected), compile_fail: false, @@ -340,15 +300,10 @@ fn test_should_panic_but_succeeds() { name: StaticTestName("whatever"), ignore: false, ignore_message: None, - #[cfg(not(bootstrap))] source_file: "", - #[cfg(not(bootstrap))] start_line: 0, - #[cfg(not(bootstrap))] start_col: 0, - #[cfg(not(bootstrap))] end_line: 0, - #[cfg(not(bootstrap))] end_col: 0, should_panic, compile_fail: false, @@ -378,15 +333,10 @@ fn report_time_test_template(report_time: bool) -> Option { name: StaticTestName("whatever"), ignore: false, ignore_message: None, - #[cfg(not(bootstrap))] source_file: "", - #[cfg(not(bootstrap))] start_line: 0, - #[cfg(not(bootstrap))] start_col: 0, - #[cfg(not(bootstrap))] end_line: 0, - #[cfg(not(bootstrap))] end_col: 0, should_panic: ShouldPanic::No, compile_fail: false, @@ -425,15 +375,10 @@ fn time_test_failure_template(test_type: TestType) -> TestResult { name: StaticTestName("whatever"), ignore: false, ignore_message: None, - #[cfg(not(bootstrap))] source_file: "", - #[cfg(not(bootstrap))] start_line: 0, - #[cfg(not(bootstrap))] start_col: 0, - #[cfg(not(bootstrap))] end_line: 0, - #[cfg(not(bootstrap))] end_col: 0, should_panic: ShouldPanic::No, compile_fail: false, @@ -474,15 +419,10 @@ fn typed_test_desc(test_type: TestType) -> TestDesc { name: StaticTestName("whatever"), ignore: false, ignore_message: None, - #[cfg(not(bootstrap))] source_file: "", - #[cfg(not(bootstrap))] start_line: 0, - #[cfg(not(bootstrap))] start_col: 0, - #[cfg(not(bootstrap))] end_line: 0, - #[cfg(not(bootstrap))] end_col: 0, should_panic: ShouldPanic::No, compile_fail: false, @@ -596,15 +536,10 @@ pub fn exclude_should_panic_option() { name: StaticTestName("3"), ignore: false, ignore_message: None, - #[cfg(not(bootstrap))] source_file: "", - #[cfg(not(bootstrap))] start_line: 0, - #[cfg(not(bootstrap))] start_col: 0, - #[cfg(not(bootstrap))] end_line: 0, - #[cfg(not(bootstrap))] end_col: 0, should_panic: ShouldPanic::Yes, compile_fail: false, @@ -630,15 +565,10 @@ pub fn exact_filter_match() { name: StaticTestName(name), ignore: false, ignore_message: None, - #[cfg(not(bootstrap))] source_file: "", - #[cfg(not(bootstrap))] start_line: 0, - #[cfg(not(bootstrap))] start_col: 0, - #[cfg(not(bootstrap))] end_line: 0, - #[cfg(not(bootstrap))] end_col: 0, should_panic: ShouldPanic::No, compile_fail: false, @@ -731,15 +661,10 @@ fn sample_tests() -> Vec { name: DynTestName((*name).clone()), ignore: false, ignore_message: None, - #[cfg(not(bootstrap))] source_file: "", - #[cfg(not(bootstrap))] start_line: 0, - #[cfg(not(bootstrap))] start_col: 0, - #[cfg(not(bootstrap))] end_line: 0, - #[cfg(not(bootstrap))] end_col: 0, should_panic: ShouldPanic::No, compile_fail: false, @@ -870,15 +795,10 @@ pub fn test_bench_no_iter() { name: StaticTestName("f"), ignore: false, ignore_message: None, - #[cfg(not(bootstrap))] source_file: "", - #[cfg(not(bootstrap))] start_line: 0, - #[cfg(not(bootstrap))] start_col: 0, - #[cfg(not(bootstrap))] end_line: 0, - #[cfg(not(bootstrap))] end_col: 0, should_panic: ShouldPanic::No, compile_fail: false, @@ -903,15 +823,10 @@ pub fn test_bench_iter() { name: StaticTestName("f"), ignore: false, ignore_message: None, - #[cfg(not(bootstrap))] source_file: "", - #[cfg(not(bootstrap))] start_line: 0, - #[cfg(not(bootstrap))] start_col: 0, - #[cfg(not(bootstrap))] end_line: 0, - #[cfg(not(bootstrap))] end_col: 0, should_panic: ShouldPanic::No, compile_fail: false, @@ -929,15 +844,10 @@ fn should_sort_failures_before_printing_them() { name: StaticTestName("a"), ignore: false, ignore_message: None, - #[cfg(not(bootstrap))] source_file: "", - #[cfg(not(bootstrap))] start_line: 0, - #[cfg(not(bootstrap))] start_col: 0, - #[cfg(not(bootstrap))] end_line: 0, - #[cfg(not(bootstrap))] end_col: 0, should_panic: ShouldPanic::No, compile_fail: false, @@ -949,15 +859,10 @@ fn should_sort_failures_before_printing_them() { name: StaticTestName("b"), ignore: false, ignore_message: None, - #[cfg(not(bootstrap))] source_file: "", - #[cfg(not(bootstrap))] start_line: 0, - #[cfg(not(bootstrap))] start_col: 0, - #[cfg(not(bootstrap))] end_line: 0, - #[cfg(not(bootstrap))] end_col: 0, should_panic: ShouldPanic::No, compile_fail: false, @@ -1006,15 +911,10 @@ fn test_dyn_bench_returning_err_fails_when_run_as_test() { name: StaticTestName("whatever"), ignore: false, ignore_message: None, - #[cfg(not(bootstrap))] source_file: "", - #[cfg(not(bootstrap))] start_line: 0, - #[cfg(not(bootstrap))] start_col: 0, - #[cfg(not(bootstrap))] end_line: 0, - #[cfg(not(bootstrap))] end_col: 0, should_panic: ShouldPanic::No, compile_fail: false, diff --git a/library/test/src/types.rs b/library/test/src/types.rs index 8d4e204c8ac12..e79914dbf4b21 100644 --- a/library/test/src/types.rs +++ b/library/test/src/types.rs @@ -119,15 +119,10 @@ pub struct TestDesc { pub name: TestName, pub ignore: bool, pub ignore_message: Option<&'static str>, - #[cfg(not(bootstrap))] pub source_file: &'static str, - #[cfg(not(bootstrap))] pub start_line: usize, - #[cfg(not(bootstrap))] pub start_col: usize, - #[cfg(not(bootstrap))] pub end_line: usize, - #[cfg(not(bootstrap))] pub end_col: usize, pub should_panic: options::ShouldPanic, pub compile_fail: bool, diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 238d167c4c276..14e1328171b9a 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -131,8 +131,7 @@ const EXTRA_CHECK_CFGS: &[(Option, &'static str, Option<&[&'static str]>)] /* Extra values not defined in the built-in targets yet, but used in std */ (Some(Mode::Std), "target_env", Some(&["libnx"])), // (Some(Mode::Std), "target_os", Some(&[])), - // #[cfg(bootstrap)] loongarch64 - (Some(Mode::Std), "target_arch", Some(&["asmjs", "spirv", "nvptx", "xtensa", "loongarch64"])), + (Some(Mode::Std), "target_arch", Some(&["asmjs", "spirv", "nvptx", "xtensa"])), /* Extra names used by dependencies */ // FIXME: Used by serde_json, but we should not be triggering on external dependencies. (Some(Mode::Rustc), "no_btreemap_remove_entry", None), @@ -152,8 +151,6 @@ const EXTRA_CHECK_CFGS: &[(Option, &'static str, Option<&[&'static str]>)] // Needed to avoid the need to copy windows.lib into the sysroot. (Some(Mode::Rustc), "windows_raw_dylib", None), (Some(Mode::ToolRustc), "windows_raw_dylib", None), - // #[cfg(bootstrap)] ohos - (Some(Mode::Std), "target_env", Some(&["ohos"])), ]; /// A structure representing a Rust compiler. diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index d71098ad89da0..575d8ee65b7ba 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -1063,15 +1063,10 @@ impl Tester for Collector { Ignore::Some(ref ignores) => ignores.iter().any(|s| target_str.contains(s)), }, ignore_message: None, - #[cfg(not(bootstrap))] source_file: "", - #[cfg(not(bootstrap))] start_line: 0, - #[cfg(not(bootstrap))] start_col: 0, - #[cfg(not(bootstrap))] end_line: 0, - #[cfg(not(bootstrap))] end_col: 0, // compiler failures are test failures should_panic: test::ShouldPanic::No, diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 4a88dc5254de6..c15afca22611b 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -14,7 +14,7 @@ #![feature(type_ascription)] #![feature(iter_intersperse)] #![feature(type_alias_impl_trait)] -#![cfg_attr(not(bootstrap), feature(impl_trait_in_assoc_type))] +#![feature(impl_trait_in_assoc_type)] #![recursion_limit = "256"] #![warn(rustc::internal)] #![allow(clippy::collapsible_if, clippy::collapsible_else_if)] diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 7166d99d792cc..9059a145b4345 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -422,19 +422,11 @@ pub struct TargetCfgs { impl TargetCfgs { fn new(config: &Config) -> TargetCfgs { - let targets: HashMap = if config.stage_id.starts_with("stage0-") - || (config.suite == "ui-fulldeps" && config.stage_id.starts_with("stage1-")) - { - // #[cfg(bootstrap)] - // Needed only for one cycle, remove during the bootstrap bump. - Self::collect_all_slow(config) - } else { - serde_json::from_str(&rustc_output( - config, - &["--print=all-target-specs-json", "-Zunstable-options"], - )) - .unwrap() - }; + let targets: HashMap = serde_json::from_str(&rustc_output( + config, + &["--print=all-target-specs-json", "-Zunstable-options"], + )) + .unwrap(); let mut current = None; let mut all_targets = HashSet::new(); @@ -475,25 +467,6 @@ impl TargetCfgs { all_pointer_widths, } } - - // #[cfg(bootstrap)] - // Needed only for one cycle, remove during the bootstrap bump. - fn collect_all_slow(config: &Config) -> HashMap { - let mut result = HashMap::new(); - for target in rustc_output(config, &["--print=target-list"]).trim().lines() { - let json = rustc_output( - config, - &["--print=target-spec-json", "-Zunstable-options", "--target", target], - ); - match serde_json::from_str(&json) { - Ok(res) => { - result.insert(target.into(), res); - } - Err(err) => panic!("failed to parse target spec for {target}: {err}"), - } - } - result - } } #[derive(Clone, Debug, serde::Deserialize)] diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index ccce62bd5b0cf..01da5981015f9 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -943,15 +943,10 @@ pub fn make_test_description( name, ignore, ignore_message, - #[cfg(not(bootstrap))] source_file: "", - #[cfg(not(bootstrap))] start_line: 0, - #[cfg(not(bootstrap))] start_col: 0, - #[cfg(not(bootstrap))] end_line: 0, - #[cfg(not(bootstrap))] end_col: 0, should_panic, compile_fail: false, diff --git a/tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.diff index cc5079af7f45d..93863fca344a6 100644 --- a/tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.diff +++ b/tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.diff @@ -24,7 +24,7 @@ _4 = &raw const (*_1); // scope 1 at $DIR/lower_intrinsics.rs:+2:55: +2:56 - _3 = option_payload_ptr::(move _4) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+2:18: +2:57 - // mir::Constant -- // + span: $DIR/lower_intrinsics.rs:133:18: 133:54 +- // + span: $DIR/lower_intrinsics.rs:132:18: 132:54 - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const Option) -> *const usize {option_payload_ptr::}, val: Value() } + _3 = &raw const (((*_4) as Some).0: usize); // scope 1 at $DIR/lower_intrinsics.rs:+2:18: +2:57 + goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+2:18: +2:57 @@ -37,7 +37,7 @@ _6 = &raw const (*_2); // scope 2 at $DIR/lower_intrinsics.rs:+3:55: +3:56 - _5 = option_payload_ptr::(move _6) -> [return: bb2, unwind unreachable]; // scope 2 at $DIR/lower_intrinsics.rs:+3:18: +3:57 - // mir::Constant -- // + span: $DIR/lower_intrinsics.rs:134:18: 134:54 +- // + span: $DIR/lower_intrinsics.rs:133:18: 133:54 - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const Option) -> *const String {option_payload_ptr::}, val: Value() } + _5 = &raw const (((*_6) as Some).0: std::string::String); // scope 2 at $DIR/lower_intrinsics.rs:+3:18: +3:57 + goto -> bb2; // scope 2 at $DIR/lower_intrinsics.rs:+3:18: +3:57 diff --git a/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.diff index e4e228371e606..37f1995a53a9d 100644 --- a/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.diff +++ b/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.diff @@ -15,7 +15,7 @@ _4 = _2; // scope 0 at $DIR/lower_intrinsics.rs:+1:33: +1:34 - _0 = offset::<*const i32, isize>(move _3, move _4) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:35 - // mir::Constant -- // + span: $DIR/lower_intrinsics.rs:140:5: 140:29 +- // + span: $DIR/lower_intrinsics.rs:139:5: 139:29 - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const i32, isize) -> *const i32 {offset::<*const i32, isize>}, val: Value() } + _0 = Offset(move _3, move _4); // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:35 + goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:35 diff --git a/tests/mir-opt/lower_intrinsics.rs b/tests/mir-opt/lower_intrinsics.rs index ad690f803c424..2b1e67be2a967 100644 --- a/tests/mir-opt/lower_intrinsics.rs +++ b/tests/mir-opt/lower_intrinsics.rs @@ -127,7 +127,6 @@ pub fn read_via_copy_uninhabited(r: &Never) -> Never { pub enum Never {} // EMIT_MIR lower_intrinsics.option_payload.LowerIntrinsics.diff -#[cfg(not(bootstrap))] pub fn option_payload(o: &Option, p: &Option) { unsafe { let _x = core::intrinsics::option_payload_ptr(o);