handle cfg(bootstrap)

This commit is contained in:
Pietro Albini 2023-04-21 15:33:04 +02:00 committed by Josh Stone
parent d64f46a553
commit a7bb8c7851
22 changed files with 111 additions and 525 deletions

View File

@ -303,7 +303,6 @@ impl<'a> Arguments<'a> {
/// When using the format_args!() macro, this function is used to generate the /// When using the format_args!() macro, this function is used to generate the
/// Arguments structure. /// Arguments structure.
#[cfg(not(bootstrap))]
#[inline] #[inline]
pub fn new_v1(pieces: &'a [&'static str], args: &'a [rt::Argument<'a>]) -> Arguments<'a> { 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 { if pieces.len() < args.len() || pieces.len() > args.len() + 1 {
@ -312,16 +311,6 @@ impl<'a> Arguments<'a> {
Arguments { pieces, fmt: None, args } 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. /// This function is used to specify nonstandard formatting parameters.
/// ///
/// An `rt::UnsafeArg` is required because the following invariants must be held /// An `rt::UnsafeArg` is required because the following invariants must be held

View File

@ -70,7 +70,6 @@ pub unsafe fn get_context<'a, 'b>(cx: ResumeTy) -> &'a mut Context<'b> {
#[doc(hidden)] #[doc(hidden)]
#[unstable(feature = "gen_future", issue = "50547")] #[unstable(feature = "gen_future", issue = "50547")]
#[inline] #[inline]
#[cfg_attr(bootstrap, lang = "identity_future")]
pub const fn identity_future<O, Fut: Future<Output = O>>(f: Fut) -> Fut { pub const fn identity_future<O, Fut: Future<Output = O>>(f: Fut) -> Fut {
f f
} }

View File

@ -1823,14 +1823,12 @@ extern "rust-intrinsic" {
/// with an even least significant digit. /// with an even least significant digit.
/// ///
/// This intrinsic does not have a stable counterpart. /// This intrinsic does not have a stable counterpart.
#[cfg(not(bootstrap))]
#[rustc_nounwind] #[rustc_nounwind]
pub fn roundevenf32(x: f32) -> f32; pub fn roundevenf32(x: f32) -> f32;
/// Returns the nearest integer to an `f64`. Rounds half-way cases to the number /// Returns the nearest integer to an `f64`. Rounds half-way cases to the number
/// with an even least significant digit. /// with an even least significant digit.
/// ///
/// This intrinsic does not have a stable counterpart. /// This intrinsic does not have a stable counterpart.
#[cfg(not(bootstrap))]
#[rustc_nounwind] #[rustc_nounwind]
pub fn roundevenf64(x: f64) -> f64; 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 /// 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 /// projections (`read_via_copy(p)`, not `read_via_copy(*p)`) so that it
/// trivially obeys runtime-MIR rules about derefs in operands. /// trivially obeys runtime-MIR rules about derefs in operands.
#[cfg(not(bootstrap))]
#[rustc_const_unstable(feature = "const_ptr_read", issue = "80377")] #[rustc_const_unstable(feature = "const_ptr_read", issue = "80377")]
#[rustc_nounwind] #[rustc_nounwind]
pub fn read_via_copy<T>(p: *const T) -> T; 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 /// This method creates a pointer to any `Some` value. If the argument is
/// `None`, an invalid within-bounds pointer (that is still acceptable for /// `None`, an invalid within-bounds pointer (that is still acceptable for
/// constructing an empty slice) is returned. /// constructing an empty slice) is returned.
#[cfg(not(bootstrap))]
#[rustc_nounwind] #[rustc_nounwind]
pub fn option_payload_ptr<T>(arg: *const Option<T>) -> *const T; pub fn option_payload_ptr<T>(arg: *const Option<T>) -> *const T;
} }

View File

@ -929,7 +929,6 @@ mod copy_impls {
reason = "internal trait for implementing various traits for all function pointers" reason = "internal trait for implementing various traits for all function pointers"
)] )]
#[lang = "fn_ptr_trait"] #[lang = "fn_ptr_trait"]
#[cfg(not(bootstrap))]
#[rustc_deny_explicit_impl] #[rustc_deny_explicit_impl]
pub trait FnPtr: Copy + Clone { pub trait FnPtr: Copy + Clone {
/// Returns the address of the function pointer. /// Returns the address of the function pointer.

View File

@ -558,7 +558,7 @@ use crate::{
/// The `Option` type. See [the module level documentation](self) for more. /// The `Option` type. See [the module level documentation](self) for more.
#[derive(Copy, PartialOrd, Eq, Ord, Debug, Hash)] #[derive(Copy, PartialOrd, Eq, Ord, Debug, Hash)]
#[rustc_diagnostic_item = "Option"] #[rustc_diagnostic_item = "Option"]
#[cfg_attr(not(bootstrap), lang = "Option")] #[lang = "Option"]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub enum Option<T> { pub enum Option<T> {
/// No value. /// No value.
@ -765,13 +765,6 @@ impl<T> Option<T> {
#[must_use] #[must_use]
#[unstable(feature = "option_as_slice", issue = "108545")] #[unstable(feature = "option_as_slice", issue = "108545")]
pub fn as_slice(&self) -> &[T] { 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 // 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 // to the payload, with a length of 1, so this is equivalent to
// `slice::from_ref`, and thus is safe. // `slice::from_ref`, and thus is safe.
@ -832,13 +825,6 @@ impl<T> Option<T> {
#[must_use] #[must_use]
#[unstable(feature = "option_as_slice", issue = "108545")] #[unstable(feature = "option_as_slice", issue = "108545")]
pub fn as_mut_slice(&mut self) -> &mut [T] { 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 // 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 // to the payload, with a length of 1, so this is equivalent to
// `slice::from_mut`, and thus is safe. // `slice::from_mut`, and thus is safe.

View File

@ -165,7 +165,7 @@ fn panic_bounds_check(index: usize, len: usize) -> ! {
#[cold] #[cold]
#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never))] #[cfg_attr(not(feature = "panic_immediate_abort"), inline(never))]
#[track_caller] #[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) -> ! { fn panic_misaligned_pointer_dereference(required: usize, found: usize) -> ! {
if cfg!(feature = "panic_immediate_abort") { if cfg!(feature = "panic_immediate_abort") {
super::intrinsics::abort() super::intrinsics::abort()

View File

@ -1,8 +1,7 @@
// `library/{std,core}/src/primitive_docs.rs` should have the same contents. // `library/{std,core}/src/primitive_docs.rs` should have the same contents.
// These are different files so that relative links work properly without // 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. // having to have `CARGO_PKG_NAME` set, but conceptually they should always be the same.
#[cfg_attr(bootstrap, doc(primitive = "bool"))] #[rustc_doc_primitive = "bool"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "bool")]
#[doc(alias = "true")] #[doc(alias = "true")]
#[doc(alias = "false")] #[doc(alias = "false")]
/// The boolean type. /// The boolean type.
@ -64,8 +63,7 @@
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_bool {} mod prim_bool {}
#[cfg_attr(bootstrap, doc(primitive = "never"))] #[rustc_doc_primitive = "never"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "never")]
#[doc(alias = "!")] #[doc(alias = "!")]
// //
/// The `!` type, also called "never". /// The `!` type, also called "never".
@ -276,8 +274,7 @@ mod prim_bool {}
#[unstable(feature = "never_type", issue = "35121")] #[unstable(feature = "never_type", issue = "35121")]
mod prim_never {} mod prim_never {}
#[cfg_attr(bootstrap, doc(primitive = "char"))] #[rustc_doc_primitive = "char"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "char")]
#[allow(rustdoc::invalid_rust_codeblocks)] #[allow(rustdoc::invalid_rust_codeblocks)]
/// A character type. /// A character type.
/// ///
@ -401,8 +398,7 @@ mod prim_never {}
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_char {} mod prim_char {}
#[cfg_attr(bootstrap, doc(primitive = "unit"))] #[rustc_doc_primitive = "unit"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "unit")]
#[doc(alias = "(")] #[doc(alias = "(")]
#[doc(alias = ")")] #[doc(alias = ")")]
#[doc(alias = "()")] #[doc(alias = "()")]
@ -464,8 +460,7 @@ impl Copy for () {
// empty // empty
} }
#[cfg_attr(bootstrap, doc(primitive = "pointer"))] #[rustc_doc_primitive = "pointer"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "pointer")]
#[doc(alias = "ptr")] #[doc(alias = "ptr")]
#[doc(alias = "*")] #[doc(alias = "*")]
#[doc(alias = "*const")] #[doc(alias = "*const")]
@ -581,8 +576,7 @@ impl Copy for () {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_pointer {} mod prim_pointer {}
#[cfg_attr(bootstrap, doc(primitive = "array"))] #[rustc_doc_primitive = "array"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "array")]
#[doc(alias = "[]")] #[doc(alias = "[]")]
#[doc(alias = "[T;N]")] // unfortunately, rustdoc doesn't have fuzzy search for aliases #[doc(alias = "[T;N]")] // unfortunately, rustdoc doesn't have fuzzy search for aliases
#[doc(alias = "[T; N]")] #[doc(alias = "[T; N]")]
@ -783,8 +777,7 @@ mod prim_pointer {}
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_array {} mod prim_array {}
#[cfg_attr(bootstrap, doc(primitive = "slice"))] #[rustc_doc_primitive = "slice"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "slice")]
#[doc(alias = "[")] #[doc(alias = "[")]
#[doc(alias = "]")] #[doc(alias = "]")]
#[doc(alias = "[]")] #[doc(alias = "[]")]
@ -876,8 +869,7 @@ mod prim_array {}
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_slice {} mod prim_slice {}
#[cfg_attr(bootstrap, doc(primitive = "str"))] #[rustc_doc_primitive = "str"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "str")]
/// String slices. /// String slices.
/// ///
/// *[See also the `std::str` module](crate::str).* /// *[See also the `std::str` module](crate::str).*
@ -944,8 +936,7 @@ mod prim_slice {}
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_str {} mod prim_str {}
#[cfg_attr(bootstrap, doc(primitive = "tuple"))] #[rustc_doc_primitive = "tuple"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "tuple")]
#[doc(alias = "(")] #[doc(alias = "(")]
#[doc(alias = ")")] #[doc(alias = ")")]
#[doc(alias = "()")] #[doc(alias = "()")]
@ -1088,8 +1079,7 @@ impl<T: Copy> Copy for (T,) {
// empty // empty
} }
#[cfg_attr(bootstrap, doc(primitive = "f32"))] #[rustc_doc_primitive = "f32"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "f32")]
/// A 32-bit floating point type (specifically, the "binary32" type defined in IEEE 754-2008). /// 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`, /// 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")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_f32 {} mod prim_f32 {}
#[cfg_attr(bootstrap, doc(primitive = "f64"))] #[rustc_doc_primitive = "f64"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "f64")]
/// A 64-bit floating point type (specifically, the "binary64" type defined in IEEE 754-2008). /// 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 /// This type is very similar to [`f32`], but has increased
@ -1171,78 +1160,67 @@ mod prim_f32 {}
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_f64 {} mod prim_f64 {}
#[cfg_attr(bootstrap, doc(primitive = "i8"))] #[rustc_doc_primitive = "i8"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i8")]
// //
/// The 8-bit signed integer type. /// The 8-bit signed integer type.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_i8 {} mod prim_i8 {}
#[cfg_attr(bootstrap, doc(primitive = "i16"))] #[rustc_doc_primitive = "i16"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i16")]
// //
/// The 16-bit signed integer type. /// The 16-bit signed integer type.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_i16 {} mod prim_i16 {}
#[cfg_attr(bootstrap, doc(primitive = "i32"))] #[rustc_doc_primitive = "i32"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i32")]
// //
/// The 32-bit signed integer type. /// The 32-bit signed integer type.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_i32 {} mod prim_i32 {}
#[cfg_attr(bootstrap, doc(primitive = "i64"))] #[rustc_doc_primitive = "i64"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i64")]
// //
/// The 64-bit signed integer type. /// The 64-bit signed integer type.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_i64 {} mod prim_i64 {}
#[cfg_attr(bootstrap, doc(primitive = "i128"))] #[rustc_doc_primitive = "i128"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i128")]
// //
/// The 128-bit signed integer type. /// The 128-bit signed integer type.
#[stable(feature = "i128", since = "1.26.0")] #[stable(feature = "i128", since = "1.26.0")]
mod prim_i128 {} mod prim_i128 {}
#[cfg_attr(bootstrap, doc(primitive = "u8"))] #[rustc_doc_primitive = "u8"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u8")]
// //
/// The 8-bit unsigned integer type. /// The 8-bit unsigned integer type.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_u8 {} mod prim_u8 {}
#[cfg_attr(bootstrap, doc(primitive = "u16"))] #[rustc_doc_primitive = "u16"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u16")]
// //
/// The 16-bit unsigned integer type. /// The 16-bit unsigned integer type.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_u16 {} mod prim_u16 {}
#[cfg_attr(bootstrap, doc(primitive = "u32"))] #[rustc_doc_primitive = "u32"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u32")]
// //
/// The 32-bit unsigned integer type. /// The 32-bit unsigned integer type.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_u32 {} mod prim_u32 {}
#[cfg_attr(bootstrap, doc(primitive = "u64"))] #[rustc_doc_primitive = "u64"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u64")]
// //
/// The 64-bit unsigned integer type. /// The 64-bit unsigned integer type.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_u64 {} mod prim_u64 {}
#[cfg_attr(bootstrap, doc(primitive = "u128"))] #[rustc_doc_primitive = "u128"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u128")]
// //
/// The 128-bit unsigned integer type. /// The 128-bit unsigned integer type.
#[stable(feature = "i128", since = "1.26.0")] #[stable(feature = "i128", since = "1.26.0")]
mod prim_u128 {} mod prim_u128 {}
#[cfg_attr(bootstrap, doc(primitive = "isize"))] #[rustc_doc_primitive = "isize"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "isize")]
// //
/// The pointer-sized signed integer type. /// The pointer-sized signed integer type.
/// ///
@ -1252,8 +1230,7 @@ mod prim_u128 {}
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_isize {} mod prim_isize {}
#[cfg_attr(bootstrap, doc(primitive = "usize"))] #[rustc_doc_primitive = "usize"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "usize")]
// //
/// The pointer-sized unsigned integer type. /// The pointer-sized unsigned integer type.
/// ///
@ -1263,8 +1240,7 @@ mod prim_isize {}
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_usize {} mod prim_usize {}
#[cfg_attr(bootstrap, doc(primitive = "reference"))] #[rustc_doc_primitive = "reference"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "reference")]
#[doc(alias = "&")] #[doc(alias = "&")]
#[doc(alias = "&mut")] #[doc(alias = "&mut")]
// //
@ -1396,8 +1372,7 @@ mod prim_usize {}
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_ref {} mod prim_ref {}
#[cfg_attr(bootstrap, doc(primitive = "fn"))] #[rustc_doc_primitive = "fn"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "fn")]
// //
/// Function pointers, like `fn(usize) -> bool`. /// Function pointers, like `fn(usize) -> bool`.
/// ///

View File

@ -374,6 +374,7 @@ use crate::hash;
use crate::intrinsics::{ use crate::intrinsics::{
self, assert_unsafe_precondition, is_aligned_and_not_null, is_nonoverlapping, self, assert_unsafe_precondition, is_aligned_and_not_null, is_nonoverlapping,
}; };
use crate::marker::FnPtr;
use crate::mem::{self, MaybeUninit}; use crate::mem::{self, MaybeUninit};
@ -1167,28 +1168,9 @@ pub const unsafe fn read<T>(src: *const T) -> T {
"ptr::read requires that the pointer argument is aligned and non-null", "ptr::read requires that the pointer argument is aligned and non-null",
[T](src: *const T) => is_aligned_and_not_null(src) [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)
} }
} }
}
/// Reads the value from `src` without moving it. This leaves the /// Reads the value from `src` without moving it. This leaves the
/// memory in `src` unchanged. /// memory in `src` unchanged.
@ -1897,159 +1879,6 @@ pub fn hash<T: ?Sized, S: hash::Hasher>(hashee: *const T, into: &mut S) {
hashee.hash(into); 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, }
};
}
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 }
}
#[cfg(not(bootstrap))]
mod new_fn_ptr_impl {
use super::*;
use crate::marker::FnPtr;
#[stable(feature = "fnptr_impls", since = "1.4.0")] #[stable(feature = "fnptr_impls", since = "1.4.0")]
impl<F: FnPtr> PartialEq for F { impl<F: FnPtr> PartialEq for F {
#[inline] #[inline]
@ -2095,7 +1924,7 @@ mod new_fn_ptr_impl {
fmt::pointer_fmt_inner(self.addr() as _, f) fmt::pointer_fmt_inner(self.addr() as _, f)
} }
} }
}
/// Create a `const` raw pointer to a place, without creating an intermediate reference. /// 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 /// Creating a reference with `&`/`&mut` is only allowed if the pointer is properly aligned

View File

@ -1,8 +1,7 @@
// `library/{std,core}/src/primitive_docs.rs` should have the same contents. // `library/{std,core}/src/primitive_docs.rs` should have the same contents.
// These are different files so that relative links work properly without // 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. // having to have `CARGO_PKG_NAME` set, but conceptually they should always be the same.
#[cfg_attr(bootstrap, doc(primitive = "bool"))] #[rustc_doc_primitive = "bool"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "bool")]
#[doc(alias = "true")] #[doc(alias = "true")]
#[doc(alias = "false")] #[doc(alias = "false")]
/// The boolean type. /// The boolean type.
@ -64,8 +63,7 @@
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_bool {} mod prim_bool {}
#[cfg_attr(bootstrap, doc(primitive = "never"))] #[rustc_doc_primitive = "never"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "never")]
#[doc(alias = "!")] #[doc(alias = "!")]
// //
/// The `!` type, also called "never". /// The `!` type, also called "never".
@ -276,8 +274,7 @@ mod prim_bool {}
#[unstable(feature = "never_type", issue = "35121")] #[unstable(feature = "never_type", issue = "35121")]
mod prim_never {} mod prim_never {}
#[cfg_attr(bootstrap, doc(primitive = "char"))] #[rustc_doc_primitive = "char"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "char")]
#[allow(rustdoc::invalid_rust_codeblocks)] #[allow(rustdoc::invalid_rust_codeblocks)]
/// A character type. /// A character type.
/// ///
@ -401,8 +398,7 @@ mod prim_never {}
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_char {} mod prim_char {}
#[cfg_attr(bootstrap, doc(primitive = "unit"))] #[rustc_doc_primitive = "unit"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "unit")]
#[doc(alias = "(")] #[doc(alias = "(")]
#[doc(alias = ")")] #[doc(alias = ")")]
#[doc(alias = "()")] #[doc(alias = "()")]
@ -464,8 +460,7 @@ impl Copy for () {
// empty // empty
} }
#[cfg_attr(bootstrap, doc(primitive = "pointer"))] #[rustc_doc_primitive = "pointer"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "pointer")]
#[doc(alias = "ptr")] #[doc(alias = "ptr")]
#[doc(alias = "*")] #[doc(alias = "*")]
#[doc(alias = "*const")] #[doc(alias = "*const")]
@ -581,8 +576,7 @@ impl Copy for () {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_pointer {} mod prim_pointer {}
#[cfg_attr(bootstrap, doc(primitive = "array"))] #[rustc_doc_primitive = "array"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "array")]
#[doc(alias = "[]")] #[doc(alias = "[]")]
#[doc(alias = "[T;N]")] // unfortunately, rustdoc doesn't have fuzzy search for aliases #[doc(alias = "[T;N]")] // unfortunately, rustdoc doesn't have fuzzy search for aliases
#[doc(alias = "[T; N]")] #[doc(alias = "[T; N]")]
@ -783,8 +777,7 @@ mod prim_pointer {}
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_array {} mod prim_array {}
#[cfg_attr(bootstrap, doc(primitive = "slice"))] #[rustc_doc_primitive = "slice"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "slice")]
#[doc(alias = "[")] #[doc(alias = "[")]
#[doc(alias = "]")] #[doc(alias = "]")]
#[doc(alias = "[]")] #[doc(alias = "[]")]
@ -876,8 +869,7 @@ mod prim_array {}
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_slice {} mod prim_slice {}
#[cfg_attr(bootstrap, doc(primitive = "str"))] #[rustc_doc_primitive = "str"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "str")]
/// String slices. /// String slices.
/// ///
/// *[See also the `std::str` module](crate::str).* /// *[See also the `std::str` module](crate::str).*
@ -944,8 +936,7 @@ mod prim_slice {}
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_str {} mod prim_str {}
#[cfg_attr(bootstrap, doc(primitive = "tuple"))] #[rustc_doc_primitive = "tuple"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "tuple")]
#[doc(alias = "(")] #[doc(alias = "(")]
#[doc(alias = ")")] #[doc(alias = ")")]
#[doc(alias = "()")] #[doc(alias = "()")]
@ -1088,8 +1079,7 @@ impl<T: Copy> Copy for (T,) {
// empty // empty
} }
#[cfg_attr(bootstrap, doc(primitive = "f32"))] #[rustc_doc_primitive = "f32"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "f32")]
/// A 32-bit floating point type (specifically, the "binary32" type defined in IEEE 754-2008). /// 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`, /// 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")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_f32 {} mod prim_f32 {}
#[cfg_attr(bootstrap, doc(primitive = "f64"))] #[rustc_doc_primitive = "f64"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "f64")]
/// A 64-bit floating point type (specifically, the "binary64" type defined in IEEE 754-2008). /// 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 /// This type is very similar to [`f32`], but has increased
@ -1171,78 +1160,67 @@ mod prim_f32 {}
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_f64 {} mod prim_f64 {}
#[cfg_attr(bootstrap, doc(primitive = "i8"))] #[rustc_doc_primitive = "i8"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i8")]
// //
/// The 8-bit signed integer type. /// The 8-bit signed integer type.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_i8 {} mod prim_i8 {}
#[cfg_attr(bootstrap, doc(primitive = "i16"))] #[rustc_doc_primitive = "i16"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i16")]
// //
/// The 16-bit signed integer type. /// The 16-bit signed integer type.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_i16 {} mod prim_i16 {}
#[cfg_attr(bootstrap, doc(primitive = "i32"))] #[rustc_doc_primitive = "i32"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i32")]
// //
/// The 32-bit signed integer type. /// The 32-bit signed integer type.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_i32 {} mod prim_i32 {}
#[cfg_attr(bootstrap, doc(primitive = "i64"))] #[rustc_doc_primitive = "i64"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i64")]
// //
/// The 64-bit signed integer type. /// The 64-bit signed integer type.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_i64 {} mod prim_i64 {}
#[cfg_attr(bootstrap, doc(primitive = "i128"))] #[rustc_doc_primitive = "i128"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "i128")]
// //
/// The 128-bit signed integer type. /// The 128-bit signed integer type.
#[stable(feature = "i128", since = "1.26.0")] #[stable(feature = "i128", since = "1.26.0")]
mod prim_i128 {} mod prim_i128 {}
#[cfg_attr(bootstrap, doc(primitive = "u8"))] #[rustc_doc_primitive = "u8"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u8")]
// //
/// The 8-bit unsigned integer type. /// The 8-bit unsigned integer type.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_u8 {} mod prim_u8 {}
#[cfg_attr(bootstrap, doc(primitive = "u16"))] #[rustc_doc_primitive = "u16"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u16")]
// //
/// The 16-bit unsigned integer type. /// The 16-bit unsigned integer type.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_u16 {} mod prim_u16 {}
#[cfg_attr(bootstrap, doc(primitive = "u32"))] #[rustc_doc_primitive = "u32"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u32")]
// //
/// The 32-bit unsigned integer type. /// The 32-bit unsigned integer type.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_u32 {} mod prim_u32 {}
#[cfg_attr(bootstrap, doc(primitive = "u64"))] #[rustc_doc_primitive = "u64"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u64")]
// //
/// The 64-bit unsigned integer type. /// The 64-bit unsigned integer type.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_u64 {} mod prim_u64 {}
#[cfg_attr(bootstrap, doc(primitive = "u128"))] #[rustc_doc_primitive = "u128"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "u128")]
// //
/// The 128-bit unsigned integer type. /// The 128-bit unsigned integer type.
#[stable(feature = "i128", since = "1.26.0")] #[stable(feature = "i128", since = "1.26.0")]
mod prim_u128 {} mod prim_u128 {}
#[cfg_attr(bootstrap, doc(primitive = "isize"))] #[rustc_doc_primitive = "isize"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "isize")]
// //
/// The pointer-sized signed integer type. /// The pointer-sized signed integer type.
/// ///
@ -1252,8 +1230,7 @@ mod prim_u128 {}
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_isize {} mod prim_isize {}
#[cfg_attr(bootstrap, doc(primitive = "usize"))] #[rustc_doc_primitive = "usize"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "usize")]
// //
/// The pointer-sized unsigned integer type. /// The pointer-sized unsigned integer type.
/// ///
@ -1263,8 +1240,7 @@ mod prim_isize {}
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_usize {} mod prim_usize {}
#[cfg_attr(bootstrap, doc(primitive = "reference"))] #[rustc_doc_primitive = "reference"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "reference")]
#[doc(alias = "&")] #[doc(alias = "&")]
#[doc(alias = "&mut")] #[doc(alias = "&mut")]
// //
@ -1396,8 +1372,7 @@ mod prim_usize {}
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_ref {} mod prim_ref {}
#[cfg_attr(bootstrap, doc(primitive = "fn"))] #[rustc_doc_primitive = "fn"]
#[cfg_attr(not(bootstrap), rustc_doc_primitive = "fn")]
// //
/// Function pointers, like `fn(usize) -> bool`. /// Function pointers, like `fn(usize) -> bool`.
/// ///

View File

@ -11,7 +11,7 @@ use crate::{fmt, mem, panic};
pub macro thread_local_inner { pub macro thread_local_inner {
// used to generate the `LocalKey` value for const-initialized thread locals // used to generate the `LocalKey` value for const-initialized thread locals
(@key $t:ty, const $init:expr) => {{ (@key $t:ty, const $init:expr) => {{
#[cfg_attr(not(bootstrap), inline)] #[inline]
#[deny(unsafe_op_in_unsafe_fn)] #[deny(unsafe_op_in_unsafe_fn)]
unsafe fn __getit( unsafe fn __getit(
_init: $crate::option::Option<&mut $crate::option::Option<$t>>, _init: $crate::option::Option<&mut $crate::option::Option<$t>>,
@ -78,7 +78,7 @@ pub macro thread_local_inner {
#[inline] #[inline]
fn __init() -> $t { $init } fn __init() -> $t { $init }
#[cfg_attr(not(bootstrap), inline)] #[inline]
unsafe fn __getit( unsafe fn __getit(
init: $crate::option::Option<&mut $crate::option::Option<$t>>, init: $crate::option::Option<&mut $crate::option::Option<$t>>,
) -> $crate::option::Option<&'static $t> { ) -> $crate::option::Option<&'static $t> {

View File

@ -11,7 +11,7 @@ use crate::{fmt, marker, panic, ptr};
pub macro thread_local_inner { pub macro thread_local_inner {
// used to generate the `LocalKey` value for const-initialized thread locals // used to generate the `LocalKey` value for const-initialized thread locals
(@key $t:ty, const $init:expr) => {{ (@key $t:ty, const $init:expr) => {{
#[cfg_attr(not(bootstrap), inline)] #[inline]
#[deny(unsafe_op_in_unsafe_fn)] #[deny(unsafe_op_in_unsafe_fn)]
unsafe fn __getit( unsafe fn __getit(
_init: $crate::option::Option<&mut $crate::option::Option<$t>>, _init: $crate::option::Option<&mut $crate::option::Option<$t>>,

View File

@ -69,30 +69,14 @@ impl<T: Write> OutputFormatter for JsonFormatter<T> {
name, name,
ignore, ignore,
ignore_message, ignore_message,
#[cfg(not(bootstrap))]
source_file, source_file,
#[cfg(not(bootstrap))]
start_line, start_line,
#[cfg(not(bootstrap))]
start_col, start_col,
#[cfg(not(bootstrap))]
end_line, end_line,
#[cfg(not(bootstrap))]
end_col, end_col,
.. ..
} = desc; } = 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!( 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} }}"#, 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()), EscapedString(name.as_slice()),

View File

@ -63,15 +63,10 @@ fn one_ignored_one_unignored_test() -> Vec<TestDescAndFn> {
name: StaticTestName("1"), name: StaticTestName("1"),
ignore: true, ignore: true,
ignore_message: None, ignore_message: None,
#[cfg(not(bootstrap))]
source_file: "", source_file: "",
#[cfg(not(bootstrap))]
start_line: 0, start_line: 0,
#[cfg(not(bootstrap))]
start_col: 0, start_col: 0,
#[cfg(not(bootstrap))]
end_line: 0, end_line: 0,
#[cfg(not(bootstrap))]
end_col: 0, end_col: 0,
should_panic: ShouldPanic::No, should_panic: ShouldPanic::No,
compile_fail: false, compile_fail: false,
@ -85,15 +80,10 @@ fn one_ignored_one_unignored_test() -> Vec<TestDescAndFn> {
name: StaticTestName("2"), name: StaticTestName("2"),
ignore: false, ignore: false,
ignore_message: None, ignore_message: None,
#[cfg(not(bootstrap))]
source_file: "", source_file: "",
#[cfg(not(bootstrap))]
start_line: 0, start_line: 0,
#[cfg(not(bootstrap))]
start_col: 0, start_col: 0,
#[cfg(not(bootstrap))]
end_line: 0, end_line: 0,
#[cfg(not(bootstrap))]
end_col: 0, end_col: 0,
should_panic: ShouldPanic::No, should_panic: ShouldPanic::No,
compile_fail: false, compile_fail: false,
@ -115,15 +105,10 @@ pub fn do_not_run_ignored_tests() {
name: StaticTestName("whatever"), name: StaticTestName("whatever"),
ignore: true, ignore: true,
ignore_message: None, ignore_message: None,
#[cfg(not(bootstrap))]
source_file: "", source_file: "",
#[cfg(not(bootstrap))]
start_line: 0, start_line: 0,
#[cfg(not(bootstrap))]
start_col: 0, start_col: 0,
#[cfg(not(bootstrap))]
end_line: 0, end_line: 0,
#[cfg(not(bootstrap))]
end_col: 0, end_col: 0,
should_panic: ShouldPanic::No, should_panic: ShouldPanic::No,
compile_fail: false, compile_fail: false,
@ -148,15 +133,10 @@ pub fn ignored_tests_result_in_ignored() {
name: StaticTestName("whatever"), name: StaticTestName("whatever"),
ignore: true, ignore: true,
ignore_message: None, ignore_message: None,
#[cfg(not(bootstrap))]
source_file: "", source_file: "",
#[cfg(not(bootstrap))]
start_line: 0, start_line: 0,
#[cfg(not(bootstrap))]
start_col: 0, start_col: 0,
#[cfg(not(bootstrap))]
end_line: 0, end_line: 0,
#[cfg(not(bootstrap))]
end_col: 0, end_col: 0,
should_panic: ShouldPanic::No, should_panic: ShouldPanic::No,
compile_fail: false, compile_fail: false,
@ -183,15 +163,10 @@ fn test_should_panic() {
name: StaticTestName("whatever"), name: StaticTestName("whatever"),
ignore: false, ignore: false,
ignore_message: None, ignore_message: None,
#[cfg(not(bootstrap))]
source_file: "", source_file: "",
#[cfg(not(bootstrap))]
start_line: 0, start_line: 0,
#[cfg(not(bootstrap))]
start_col: 0, start_col: 0,
#[cfg(not(bootstrap))]
end_line: 0, end_line: 0,
#[cfg(not(bootstrap))]
end_col: 0, end_col: 0,
should_panic: ShouldPanic::Yes, should_panic: ShouldPanic::Yes,
compile_fail: false, compile_fail: false,
@ -218,15 +193,10 @@ fn test_should_panic_good_message() {
name: StaticTestName("whatever"), name: StaticTestName("whatever"),
ignore: false, ignore: false,
ignore_message: None, ignore_message: None,
#[cfg(not(bootstrap))]
source_file: "", source_file: "",
#[cfg(not(bootstrap))]
start_line: 0, start_line: 0,
#[cfg(not(bootstrap))]
start_col: 0, start_col: 0,
#[cfg(not(bootstrap))]
end_line: 0, end_line: 0,
#[cfg(not(bootstrap))]
end_col: 0, end_col: 0,
should_panic: ShouldPanic::YesWithMessage("error message"), should_panic: ShouldPanic::YesWithMessage("error message"),
compile_fail: false, compile_fail: false,
@ -258,15 +228,10 @@ fn test_should_panic_bad_message() {
name: StaticTestName("whatever"), name: StaticTestName("whatever"),
ignore: false, ignore: false,
ignore_message: None, ignore_message: None,
#[cfg(not(bootstrap))]
source_file: "", source_file: "",
#[cfg(not(bootstrap))]
start_line: 0, start_line: 0,
#[cfg(not(bootstrap))]
start_col: 0, start_col: 0,
#[cfg(not(bootstrap))]
end_line: 0, end_line: 0,
#[cfg(not(bootstrap))]
end_col: 0, end_col: 0,
should_panic: ShouldPanic::YesWithMessage(expected), should_panic: ShouldPanic::YesWithMessage(expected),
compile_fail: false, compile_fail: false,
@ -302,15 +267,10 @@ fn test_should_panic_non_string_message_type() {
name: StaticTestName("whatever"), name: StaticTestName("whatever"),
ignore: false, ignore: false,
ignore_message: None, ignore_message: None,
#[cfg(not(bootstrap))]
source_file: "", source_file: "",
#[cfg(not(bootstrap))]
start_line: 0, start_line: 0,
#[cfg(not(bootstrap))]
start_col: 0, start_col: 0,
#[cfg(not(bootstrap))]
end_line: 0, end_line: 0,
#[cfg(not(bootstrap))]
end_col: 0, end_col: 0,
should_panic: ShouldPanic::YesWithMessage(expected), should_panic: ShouldPanic::YesWithMessage(expected),
compile_fail: false, compile_fail: false,
@ -340,15 +300,10 @@ fn test_should_panic_but_succeeds() {
name: StaticTestName("whatever"), name: StaticTestName("whatever"),
ignore: false, ignore: false,
ignore_message: None, ignore_message: None,
#[cfg(not(bootstrap))]
source_file: "", source_file: "",
#[cfg(not(bootstrap))]
start_line: 0, start_line: 0,
#[cfg(not(bootstrap))]
start_col: 0, start_col: 0,
#[cfg(not(bootstrap))]
end_line: 0, end_line: 0,
#[cfg(not(bootstrap))]
end_col: 0, end_col: 0,
should_panic, should_panic,
compile_fail: false, compile_fail: false,
@ -378,15 +333,10 @@ fn report_time_test_template(report_time: bool) -> Option<TestExecTime> {
name: StaticTestName("whatever"), name: StaticTestName("whatever"),
ignore: false, ignore: false,
ignore_message: None, ignore_message: None,
#[cfg(not(bootstrap))]
source_file: "", source_file: "",
#[cfg(not(bootstrap))]
start_line: 0, start_line: 0,
#[cfg(not(bootstrap))]
start_col: 0, start_col: 0,
#[cfg(not(bootstrap))]
end_line: 0, end_line: 0,
#[cfg(not(bootstrap))]
end_col: 0, end_col: 0,
should_panic: ShouldPanic::No, should_panic: ShouldPanic::No,
compile_fail: false, compile_fail: false,
@ -425,15 +375,10 @@ fn time_test_failure_template(test_type: TestType) -> TestResult {
name: StaticTestName("whatever"), name: StaticTestName("whatever"),
ignore: false, ignore: false,
ignore_message: None, ignore_message: None,
#[cfg(not(bootstrap))]
source_file: "", source_file: "",
#[cfg(not(bootstrap))]
start_line: 0, start_line: 0,
#[cfg(not(bootstrap))]
start_col: 0, start_col: 0,
#[cfg(not(bootstrap))]
end_line: 0, end_line: 0,
#[cfg(not(bootstrap))]
end_col: 0, end_col: 0,
should_panic: ShouldPanic::No, should_panic: ShouldPanic::No,
compile_fail: false, compile_fail: false,
@ -474,15 +419,10 @@ fn typed_test_desc(test_type: TestType) -> TestDesc {
name: StaticTestName("whatever"), name: StaticTestName("whatever"),
ignore: false, ignore: false,
ignore_message: None, ignore_message: None,
#[cfg(not(bootstrap))]
source_file: "", source_file: "",
#[cfg(not(bootstrap))]
start_line: 0, start_line: 0,
#[cfg(not(bootstrap))]
start_col: 0, start_col: 0,
#[cfg(not(bootstrap))]
end_line: 0, end_line: 0,
#[cfg(not(bootstrap))]
end_col: 0, end_col: 0,
should_panic: ShouldPanic::No, should_panic: ShouldPanic::No,
compile_fail: false, compile_fail: false,
@ -596,15 +536,10 @@ pub fn exclude_should_panic_option() {
name: StaticTestName("3"), name: StaticTestName("3"),
ignore: false, ignore: false,
ignore_message: None, ignore_message: None,
#[cfg(not(bootstrap))]
source_file: "", source_file: "",
#[cfg(not(bootstrap))]
start_line: 0, start_line: 0,
#[cfg(not(bootstrap))]
start_col: 0, start_col: 0,
#[cfg(not(bootstrap))]
end_line: 0, end_line: 0,
#[cfg(not(bootstrap))]
end_col: 0, end_col: 0,
should_panic: ShouldPanic::Yes, should_panic: ShouldPanic::Yes,
compile_fail: false, compile_fail: false,
@ -630,15 +565,10 @@ pub fn exact_filter_match() {
name: StaticTestName(name), name: StaticTestName(name),
ignore: false, ignore: false,
ignore_message: None, ignore_message: None,
#[cfg(not(bootstrap))]
source_file: "", source_file: "",
#[cfg(not(bootstrap))]
start_line: 0, start_line: 0,
#[cfg(not(bootstrap))]
start_col: 0, start_col: 0,
#[cfg(not(bootstrap))]
end_line: 0, end_line: 0,
#[cfg(not(bootstrap))]
end_col: 0, end_col: 0,
should_panic: ShouldPanic::No, should_panic: ShouldPanic::No,
compile_fail: false, compile_fail: false,
@ -731,15 +661,10 @@ fn sample_tests() -> Vec<TestDescAndFn> {
name: DynTestName((*name).clone()), name: DynTestName((*name).clone()),
ignore: false, ignore: false,
ignore_message: None, ignore_message: None,
#[cfg(not(bootstrap))]
source_file: "", source_file: "",
#[cfg(not(bootstrap))]
start_line: 0, start_line: 0,
#[cfg(not(bootstrap))]
start_col: 0, start_col: 0,
#[cfg(not(bootstrap))]
end_line: 0, end_line: 0,
#[cfg(not(bootstrap))]
end_col: 0, end_col: 0,
should_panic: ShouldPanic::No, should_panic: ShouldPanic::No,
compile_fail: false, compile_fail: false,
@ -870,15 +795,10 @@ pub fn test_bench_no_iter() {
name: StaticTestName("f"), name: StaticTestName("f"),
ignore: false, ignore: false,
ignore_message: None, ignore_message: None,
#[cfg(not(bootstrap))]
source_file: "", source_file: "",
#[cfg(not(bootstrap))]
start_line: 0, start_line: 0,
#[cfg(not(bootstrap))]
start_col: 0, start_col: 0,
#[cfg(not(bootstrap))]
end_line: 0, end_line: 0,
#[cfg(not(bootstrap))]
end_col: 0, end_col: 0,
should_panic: ShouldPanic::No, should_panic: ShouldPanic::No,
compile_fail: false, compile_fail: false,
@ -903,15 +823,10 @@ pub fn test_bench_iter() {
name: StaticTestName("f"), name: StaticTestName("f"),
ignore: false, ignore: false,
ignore_message: None, ignore_message: None,
#[cfg(not(bootstrap))]
source_file: "", source_file: "",
#[cfg(not(bootstrap))]
start_line: 0, start_line: 0,
#[cfg(not(bootstrap))]
start_col: 0, start_col: 0,
#[cfg(not(bootstrap))]
end_line: 0, end_line: 0,
#[cfg(not(bootstrap))]
end_col: 0, end_col: 0,
should_panic: ShouldPanic::No, should_panic: ShouldPanic::No,
compile_fail: false, compile_fail: false,
@ -929,15 +844,10 @@ fn should_sort_failures_before_printing_them() {
name: StaticTestName("a"), name: StaticTestName("a"),
ignore: false, ignore: false,
ignore_message: None, ignore_message: None,
#[cfg(not(bootstrap))]
source_file: "", source_file: "",
#[cfg(not(bootstrap))]
start_line: 0, start_line: 0,
#[cfg(not(bootstrap))]
start_col: 0, start_col: 0,
#[cfg(not(bootstrap))]
end_line: 0, end_line: 0,
#[cfg(not(bootstrap))]
end_col: 0, end_col: 0,
should_panic: ShouldPanic::No, should_panic: ShouldPanic::No,
compile_fail: false, compile_fail: false,
@ -949,15 +859,10 @@ fn should_sort_failures_before_printing_them() {
name: StaticTestName("b"), name: StaticTestName("b"),
ignore: false, ignore: false,
ignore_message: None, ignore_message: None,
#[cfg(not(bootstrap))]
source_file: "", source_file: "",
#[cfg(not(bootstrap))]
start_line: 0, start_line: 0,
#[cfg(not(bootstrap))]
start_col: 0, start_col: 0,
#[cfg(not(bootstrap))]
end_line: 0, end_line: 0,
#[cfg(not(bootstrap))]
end_col: 0, end_col: 0,
should_panic: ShouldPanic::No, should_panic: ShouldPanic::No,
compile_fail: false, compile_fail: false,
@ -1006,15 +911,10 @@ fn test_dyn_bench_returning_err_fails_when_run_as_test() {
name: StaticTestName("whatever"), name: StaticTestName("whatever"),
ignore: false, ignore: false,
ignore_message: None, ignore_message: None,
#[cfg(not(bootstrap))]
source_file: "", source_file: "",
#[cfg(not(bootstrap))]
start_line: 0, start_line: 0,
#[cfg(not(bootstrap))]
start_col: 0, start_col: 0,
#[cfg(not(bootstrap))]
end_line: 0, end_line: 0,
#[cfg(not(bootstrap))]
end_col: 0, end_col: 0,
should_panic: ShouldPanic::No, should_panic: ShouldPanic::No,
compile_fail: false, compile_fail: false,

View File

@ -119,15 +119,10 @@ pub struct TestDesc {
pub name: TestName, pub name: TestName,
pub ignore: bool, pub ignore: bool,
pub ignore_message: Option<&'static str>, pub ignore_message: Option<&'static str>,
#[cfg(not(bootstrap))]
pub source_file: &'static str, pub source_file: &'static str,
#[cfg(not(bootstrap))]
pub start_line: usize, pub start_line: usize,
#[cfg(not(bootstrap))]
pub start_col: usize, pub start_col: usize,
#[cfg(not(bootstrap))]
pub end_line: usize, pub end_line: usize,
#[cfg(not(bootstrap))]
pub end_col: usize, pub end_col: usize,
pub should_panic: options::ShouldPanic, pub should_panic: options::ShouldPanic,
pub compile_fail: bool, pub compile_fail: bool,

View File

@ -131,8 +131,7 @@ const EXTRA_CHECK_CFGS: &[(Option<Mode>, &'static str, Option<&[&'static str]>)]
/* Extra values not defined in the built-in targets yet, but used in std */ /* 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_env", Some(&["libnx"])),
// (Some(Mode::Std), "target_os", Some(&[])), // (Some(Mode::Std), "target_os", Some(&[])),
// #[cfg(bootstrap)] loongarch64 (Some(Mode::Std), "target_arch", Some(&["asmjs", "spirv", "nvptx", "xtensa"])),
(Some(Mode::Std), "target_arch", Some(&["asmjs", "spirv", "nvptx", "xtensa", "loongarch64"])),
/* Extra names used by dependencies */ /* Extra names used by dependencies */
// FIXME: Used by serde_json, but we should not be triggering on external dependencies. // FIXME: Used by serde_json, but we should not be triggering on external dependencies.
(Some(Mode::Rustc), "no_btreemap_remove_entry", None), (Some(Mode::Rustc), "no_btreemap_remove_entry", None),
@ -152,8 +151,6 @@ const EXTRA_CHECK_CFGS: &[(Option<Mode>, &'static str, Option<&[&'static str]>)]
// Needed to avoid the need to copy windows.lib into the sysroot. // Needed to avoid the need to copy windows.lib into the sysroot.
(Some(Mode::Rustc), "windows_raw_dylib", None), (Some(Mode::Rustc), "windows_raw_dylib", None),
(Some(Mode::ToolRustc), "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. /// A structure representing a Rust compiler.

View File

@ -1063,15 +1063,10 @@ impl Tester for Collector {
Ignore::Some(ref ignores) => ignores.iter().any(|s| target_str.contains(s)), Ignore::Some(ref ignores) => ignores.iter().any(|s| target_str.contains(s)),
}, },
ignore_message: None, ignore_message: None,
#[cfg(not(bootstrap))]
source_file: "", source_file: "",
#[cfg(not(bootstrap))]
start_line: 0, start_line: 0,
#[cfg(not(bootstrap))]
start_col: 0, start_col: 0,
#[cfg(not(bootstrap))]
end_line: 0, end_line: 0,
#[cfg(not(bootstrap))]
end_col: 0, end_col: 0,
// compiler failures are test failures // compiler failures are test failures
should_panic: test::ShouldPanic::No, should_panic: test::ShouldPanic::No,

View File

@ -14,7 +14,7 @@
#![feature(type_ascription)] #![feature(type_ascription)]
#![feature(iter_intersperse)] #![feature(iter_intersperse)]
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
#![cfg_attr(not(bootstrap), feature(impl_trait_in_assoc_type))] #![feature(impl_trait_in_assoc_type)]
#![recursion_limit = "256"] #![recursion_limit = "256"]
#![warn(rustc::internal)] #![warn(rustc::internal)]
#![allow(clippy::collapsible_if, clippy::collapsible_else_if)] #![allow(clippy::collapsible_if, clippy::collapsible_else_if)]

View File

@ -422,19 +422,11 @@ pub struct TargetCfgs {
impl TargetCfgs { impl TargetCfgs {
fn new(config: &Config) -> TargetCfgs { fn new(config: &Config) -> TargetCfgs {
let targets: HashMap<String, TargetCfg> = if config.stage_id.starts_with("stage0-") let targets: HashMap<String, TargetCfg> = serde_json::from_str(&rustc_output(
|| (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, config,
&["--print=all-target-specs-json", "-Zunstable-options"], &["--print=all-target-specs-json", "-Zunstable-options"],
)) ))
.unwrap() .unwrap();
};
let mut current = None; let mut current = None;
let mut all_targets = HashSet::new(); let mut all_targets = HashSet::new();
@ -475,25 +467,6 @@ impl TargetCfgs {
all_pointer_widths, all_pointer_widths,
} }
} }
// #[cfg(bootstrap)]
// Needed only for one cycle, remove during the bootstrap bump.
fn collect_all_slow(config: &Config) -> HashMap<String, TargetCfg> {
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)] #[derive(Clone, Debug, serde::Deserialize)]

View File

@ -943,15 +943,10 @@ pub fn make_test_description<R: Read>(
name, name,
ignore, ignore,
ignore_message, ignore_message,
#[cfg(not(bootstrap))]
source_file: "", source_file: "",
#[cfg(not(bootstrap))]
start_line: 0, start_line: 0,
#[cfg(not(bootstrap))]
start_col: 0, start_col: 0,
#[cfg(not(bootstrap))]
end_line: 0, end_line: 0,
#[cfg(not(bootstrap))]
end_col: 0, end_col: 0,
should_panic, should_panic,
compile_fail: false, compile_fail: false,

View File

@ -24,7 +24,7 @@
_4 = &raw const (*_1); // scope 1 at $DIR/lower_intrinsics.rs:+2:55: +2:56 _4 = &raw const (*_1); // scope 1 at $DIR/lower_intrinsics.rs:+2:55: +2:56
- _3 = option_payload_ptr::<usize>(move _4) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+2:18: +2:57 - _3 = option_payload_ptr::<usize>(move _4) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+2:18: +2:57
- // mir::Constant - // 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<usize>) -> *const usize {option_payload_ptr::<usize>}, val: Value(<ZST>) } - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const Option<usize>) -> *const usize {option_payload_ptr::<usize>}, val: Value(<ZST>) }
+ _3 = &raw const (((*_4) as Some).0: usize); // scope 1 at $DIR/lower_intrinsics.rs:+2:18: +2:57 + _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 + 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 _6 = &raw const (*_2); // scope 2 at $DIR/lower_intrinsics.rs:+3:55: +3:56
- _5 = option_payload_ptr::<String>(move _6) -> [return: bb2, unwind unreachable]; // scope 2 at $DIR/lower_intrinsics.rs:+3:18: +3:57 - _5 = option_payload_ptr::<String>(move _6) -> [return: bb2, unwind unreachable]; // scope 2 at $DIR/lower_intrinsics.rs:+3:18: +3:57
- // mir::Constant - // 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<String>) -> *const String {option_payload_ptr::<String>}, val: Value(<ZST>) } - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const Option<String>) -> *const String {option_payload_ptr::<String>}, val: Value(<ZST>) }
+ _5 = &raw const (((*_6) as Some).0: std::string::String); // scope 2 at $DIR/lower_intrinsics.rs:+3:18: +3:57 + _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 + goto -> bb2; // scope 2 at $DIR/lower_intrinsics.rs:+3:18: +3:57

View File

@ -15,7 +15,7 @@
_4 = _2; // scope 0 at $DIR/lower_intrinsics.rs:+1:33: +1:34 _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 - _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 - // 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(<ZST>) } - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const i32, isize) -> *const i32 {offset::<*const i32, isize>}, val: Value(<ZST>) }
+ _0 = Offset(move _3, move _4); // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:35 + _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 + goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:35

View File

@ -127,7 +127,6 @@ pub fn read_via_copy_uninhabited(r: &Never) -> Never {
pub enum Never {} pub enum Never {}
// EMIT_MIR lower_intrinsics.option_payload.LowerIntrinsics.diff // EMIT_MIR lower_intrinsics.option_payload.LowerIntrinsics.diff
#[cfg(not(bootstrap))]
pub fn option_payload(o: &Option<usize>, p: &Option<String>) { pub fn option_payload(o: &Option<usize>, p: &Option<String>) {
unsafe { unsafe {
let _x = core::intrinsics::option_payload_ptr(o); let _x = core::intrinsics::option_payload_ptr(o);