Auto merge of #122754 - Mark-Simulacrum:bootstrap-bump, r=albertlarsan68
Bump to 1.78 bootstrap compiler https://forge.rust-lang.org/release/process.html#master-bootstrap-update-t-2-day-tuesday
This commit is contained in:
@@ -396,7 +396,7 @@ pub trait AsMut<T: ?Sized> {
|
||||
/// For example, take this code:
|
||||
///
|
||||
/// ```
|
||||
/// # #![cfg_attr(not(bootstrap), allow(non_local_definitions))]
|
||||
/// # #![allow(non_local_definitions)]
|
||||
/// struct Wrapper<T>(Vec<T>);
|
||||
/// impl<T> From<Wrapper<T>> for Vec<T> {
|
||||
/// fn from(w: Wrapper<T>) -> Vec<T> {
|
||||
|
||||
@@ -438,13 +438,7 @@ impl CStr {
|
||||
unsafe { &*(bytes as *const [u8] as *const CStr) }
|
||||
}
|
||||
|
||||
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
|
||||
// SAFETY: The const and runtime versions have identical behavior
|
||||
// unless the safety contract of `from_bytes_with_nul_unchecked` is
|
||||
// violated, which is UB.
|
||||
unsafe {
|
||||
intrinsics::const_eval_select((bytes,), const_impl, rt_impl)
|
||||
}
|
||||
intrinsics::const_eval_select((bytes,), const_impl, rt_impl)
|
||||
}
|
||||
|
||||
/// Returns the inner pointer to this C string.
|
||||
@@ -759,11 +753,7 @@ const unsafe fn const_strlen(ptr: *const c_char) -> usize {
|
||||
unsafe { strlen(s) }
|
||||
}
|
||||
|
||||
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
|
||||
// SAFETY: the two functions always provide equivalent functionality
|
||||
unsafe {
|
||||
intrinsics::const_eval_select((ptr,), strlen_ct, strlen_rt)
|
||||
}
|
||||
intrinsics::const_eval_select((ptr,), strlen_ct, strlen_rt)
|
||||
}
|
||||
|
||||
/// An iterator over the bytes of a [`CStr`], without the nul terminator.
|
||||
|
||||
@@ -454,7 +454,7 @@ pub trait Hasher {
|
||||
/// ```
|
||||
/// #![feature(hasher_prefixfree_extras)]
|
||||
/// # // Stubs to make the `impl` below pass the compiler
|
||||
/// # #![cfg_attr(not(bootstrap), allow(non_local_definitions))]
|
||||
/// # #![allow(non_local_definitions)]
|
||||
/// # struct MyCollection<T>(Option<T>);
|
||||
/// # impl<T> MyCollection<T> {
|
||||
/// # fn len(&self) -> usize { todo!() }
|
||||
|
||||
@@ -84,9 +84,6 @@ pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
|
||||
unsafe { crate::ptr::drop_in_place(to_drop) }
|
||||
}
|
||||
|
||||
#[cfg(bootstrap)]
|
||||
pub use self::r#try as catch_unwind;
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
// N.B., these intrinsics take raw pointers because they mutate aliased
|
||||
// memory, which is not valid for either `&` or `&mut`.
|
||||
@@ -965,8 +962,7 @@ extern "rust-intrinsic" {
|
||||
#[rustc_const_stable(feature = "const_assume", since = "1.77.0")]
|
||||
#[rustc_nounwind]
|
||||
#[unstable(feature = "core_intrinsics", issue = "none")]
|
||||
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
|
||||
#[cfg_attr(bootstrap, inline)]
|
||||
#[rustc_intrinsic]
|
||||
pub const unsafe fn assume(b: bool) {
|
||||
if !b {
|
||||
// SAFETY: the caller must guarantee the argument is never `false`
|
||||
@@ -987,9 +983,8 @@ pub const unsafe fn assume(b: bool) {
|
||||
/// This intrinsic does not have a stable counterpart.
|
||||
#[rustc_const_unstable(feature = "const_likely", issue = "none")]
|
||||
#[unstable(feature = "core_intrinsics", issue = "none")]
|
||||
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
|
||||
#[rustc_intrinsic]
|
||||
#[rustc_nounwind]
|
||||
#[cfg_attr(bootstrap, inline)]
|
||||
pub const fn likely(b: bool) -> bool {
|
||||
b
|
||||
}
|
||||
@@ -1007,9 +1002,8 @@ pub const fn likely(b: bool) -> bool {
|
||||
/// This intrinsic does not have a stable counterpart.
|
||||
#[rustc_const_unstable(feature = "const_likely", issue = "none")]
|
||||
#[unstable(feature = "core_intrinsics", issue = "none")]
|
||||
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
|
||||
#[rustc_intrinsic]
|
||||
#[rustc_nounwind]
|
||||
#[cfg_attr(bootstrap, inline)]
|
||||
pub const fn unlikely(b: bool) -> bool {
|
||||
b
|
||||
}
|
||||
@@ -1919,7 +1913,6 @@ extern "rust-intrinsic" {
|
||||
/// This intrinsic does not have a stable counterpart.
|
||||
#[rustc_nounwind]
|
||||
#[rustc_safe_intrinsic]
|
||||
#[cfg(not(bootstrap))]
|
||||
pub fn fadd_algebraic<T: Copy>(a: T, b: T) -> T;
|
||||
|
||||
/// Float subtraction that allows optimizations based on algebraic rules.
|
||||
@@ -1927,7 +1920,6 @@ extern "rust-intrinsic" {
|
||||
/// This intrinsic does not have a stable counterpart.
|
||||
#[rustc_nounwind]
|
||||
#[rustc_safe_intrinsic]
|
||||
#[cfg(not(bootstrap))]
|
||||
pub fn fsub_algebraic<T: Copy>(a: T, b: T) -> T;
|
||||
|
||||
/// Float multiplication that allows optimizations based on algebraic rules.
|
||||
@@ -1935,7 +1927,6 @@ extern "rust-intrinsic" {
|
||||
/// This intrinsic does not have a stable counterpart.
|
||||
#[rustc_nounwind]
|
||||
#[rustc_safe_intrinsic]
|
||||
#[cfg(not(bootstrap))]
|
||||
pub fn fmul_algebraic<T: Copy>(a: T, b: T) -> T;
|
||||
|
||||
/// Float division that allows optimizations based on algebraic rules.
|
||||
@@ -1943,7 +1934,6 @@ extern "rust-intrinsic" {
|
||||
/// This intrinsic does not have a stable counterpart.
|
||||
#[rustc_nounwind]
|
||||
#[rustc_safe_intrinsic]
|
||||
#[cfg(not(bootstrap))]
|
||||
pub fn fdiv_algebraic<T: Copy>(a: T, b: T) -> T;
|
||||
|
||||
/// Float remainder that allows optimizations based on algebraic rules.
|
||||
@@ -1951,7 +1941,6 @@ extern "rust-intrinsic" {
|
||||
/// This intrinsic does not have a stable counterpart.
|
||||
#[rustc_nounwind]
|
||||
#[rustc_safe_intrinsic]
|
||||
#[cfg(not(bootstrap))]
|
||||
pub fn frem_algebraic<T: Copy>(a: T, b: T) -> T;
|
||||
|
||||
/// Convert with LLVM’s fptoui/fptosi, which may return undef for values out of range
|
||||
@@ -2407,14 +2396,8 @@ extern "rust-intrinsic" {
|
||||
///
|
||||
/// The stable version of this intrinsic is `std::panic::catch_unwind`.
|
||||
#[rustc_nounwind]
|
||||
#[cfg(not(bootstrap))]
|
||||
pub fn catch_unwind(try_fn: fn(*mut u8), data: *mut u8, catch_fn: fn(*mut u8, *mut u8)) -> i32;
|
||||
|
||||
/// For bootstrap only, see `catch_unwind`.
|
||||
#[rustc_nounwind]
|
||||
#[cfg(bootstrap)]
|
||||
pub fn r#try(try_fn: fn(*mut u8), data: *mut u8, catch_fn: fn(*mut u8, *mut u8)) -> i32;
|
||||
|
||||
/// Emits a `!nontemporal` store according to LLVM (see their docs).
|
||||
/// Probably will never become stable.
|
||||
///
|
||||
@@ -2518,9 +2501,9 @@ extern "rust-intrinsic" {
|
||||
#[cfg(bootstrap)]
|
||||
pub fn vtable_align(ptr: *const ()) -> usize;
|
||||
|
||||
#[cfg(bootstrap)]
|
||||
#[rustc_const_unstable(feature = "const_eval_select", issue = "none")]
|
||||
#[cfg_attr(not(bootstrap), rustc_safe_intrinsic)]
|
||||
#[rustc_safe_intrinsic]
|
||||
#[cfg(bootstrap)]
|
||||
pub fn const_eval_select<ARG: Tuple, F, G, RET>(
|
||||
arg: ARG,
|
||||
called_in_const: F,
|
||||
@@ -2650,8 +2633,7 @@ where
|
||||
#[rustc_const_unstable(feature = "is_val_statically_known", issue = "none")]
|
||||
#[rustc_nounwind]
|
||||
#[unstable(feature = "core_intrinsics", issue = "none")]
|
||||
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
|
||||
#[cfg_attr(bootstrap, inline)]
|
||||
#[rustc_intrinsic]
|
||||
pub const fn is_val_statically_known<T: Copy>(_arg: T) -> bool {
|
||||
false
|
||||
}
|
||||
@@ -2670,7 +2652,7 @@ pub const fn is_val_statically_known<T: Copy>(_arg: T) -> bool {
|
||||
#[rustc_const_unstable(feature = "ub_checks", issue = "none")]
|
||||
#[unstable(feature = "core_intrinsics", issue = "none")]
|
||||
#[inline(always)]
|
||||
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
|
||||
#[rustc_intrinsic]
|
||||
pub(crate) const fn check_library_ub() -> bool {
|
||||
cfg!(debug_assertions)
|
||||
}
|
||||
@@ -2686,7 +2668,7 @@ pub(crate) const fn check_library_ub() -> bool {
|
||||
#[rustc_const_unstable(feature = "ub_checks", issue = "none")]
|
||||
#[unstable(feature = "core_intrinsics", issue = "none")]
|
||||
#[inline(always)]
|
||||
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
|
||||
#[rustc_intrinsic]
|
||||
pub(crate) const fn check_language_ub() -> bool {
|
||||
cfg!(debug_assertions)
|
||||
}
|
||||
@@ -2702,8 +2684,7 @@ pub(crate) const fn check_language_ub() -> bool {
|
||||
#[rustc_const_unstable(feature = "const_heap", issue = "79597")]
|
||||
#[unstable(feature = "core_intrinsics", issue = "none")]
|
||||
#[rustc_nounwind]
|
||||
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
|
||||
#[cfg_attr(bootstrap, inline)]
|
||||
#[rustc_intrinsic]
|
||||
pub const unsafe fn const_allocate(_size: usize, _align: usize) -> *mut u8 {
|
||||
// const eval overrides this function, but runtime code should always just return null pointers.
|
||||
crate::ptr::null_mut()
|
||||
@@ -2722,8 +2703,7 @@ pub const unsafe fn const_allocate(_size: usize, _align: usize) -> *mut u8 {
|
||||
#[rustc_const_unstable(feature = "const_heap", issue = "79597")]
|
||||
#[unstable(feature = "core_intrinsics", issue = "none")]
|
||||
#[rustc_nounwind]
|
||||
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
|
||||
#[cfg_attr(bootstrap, inline)]
|
||||
#[rustc_intrinsic]
|
||||
pub const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
|
||||
|
||||
/// `ptr` must point to a vtable.
|
||||
@@ -2799,15 +2779,6 @@ pub unsafe fn vtable_align(_ptr: *const ()) -> usize {
|
||||
macro_rules! assert_unsafe_precondition {
|
||||
($kind:ident, $message:expr, ($($name:ident:$ty:ty = $arg:expr),*$(,)?) => $e:expr $(,)?) => {
|
||||
{
|
||||
// #[cfg(bootstrap)] (this comment)
|
||||
// When the standard library is compiled with debug assertions, we want the check to inline for better performance.
|
||||
// This is important when working on the compiler, which is compiled with debug assertions locally.
|
||||
// When not compiled with debug assertions (so the precompiled std) we outline the check to minimize the compile
|
||||
// time impact when debug assertions are disabled.
|
||||
// The proper solution to this is the `#[rustc_no_mir_inline]` below, but we still want decent performance for cfg(bootstrap).
|
||||
#[cfg_attr(all(debug_assertions, bootstrap), inline(always))]
|
||||
#[cfg_attr(all(not(debug_assertions), bootstrap), inline(never))]
|
||||
|
||||
// This check is inlineable, but not by the MIR inliner.
|
||||
// The reason for this is that the MIR inliner is in an exceptionally bad position
|
||||
// to think about whether or not to inline this. In MIR, this call is gated behind `debug_assertions`,
|
||||
@@ -2816,8 +2787,8 @@ macro_rules! assert_unsafe_precondition {
|
||||
//
|
||||
// LLVM on the other hand sees the constant branch, so if it's `false`, it can immediately delete it without
|
||||
// inlining the check. If it's `true`, it can inline it and get significantly better performance.
|
||||
#[cfg_attr(not(bootstrap), rustc_no_mir_inline)]
|
||||
#[cfg_attr(not(bootstrap), inline)]
|
||||
#[rustc_no_mir_inline]
|
||||
#[inline]
|
||||
#[rustc_nounwind]
|
||||
#[rustc_const_unstable(feature = "ub_checks", issue = "none")]
|
||||
const fn precondition_check($($name:$ty),*) {
|
||||
@@ -2885,13 +2856,7 @@ pub(crate) const fn is_nonoverlapping(
|
||||
true
|
||||
}
|
||||
|
||||
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
|
||||
// SAFETY: This function's precondition is equivalent to that of `const_eval_select`.
|
||||
// Programs which do not execute UB will only see this function return `true`, which makes the
|
||||
// const and runtime implementation indistinguishable.
|
||||
unsafe {
|
||||
const_eval_select((src, dst, size, count), comptime, runtime)
|
||||
}
|
||||
const_eval_select((src, dst, size, count), comptime, runtime)
|
||||
}
|
||||
|
||||
/// Copies `count * size_of::<T>()` bytes from `src` to `dst`. The source
|
||||
@@ -3208,9 +3173,5 @@ pub(crate) const fn miri_promise_symbolic_alignment(ptr: *const (), align: usize
|
||||
|
||||
const fn compiletime(_ptr: *const (), _align: usize) {}
|
||||
|
||||
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
|
||||
// SAFETY: the extra behavior at runtime is for UB checks only.
|
||||
unsafe {
|
||||
const_eval_select((ptr, align), compiletime, runtime);
|
||||
}
|
||||
const_eval_select((ptr, align), compiletime, runtime);
|
||||
}
|
||||
|
||||
@@ -2,11 +2,7 @@
|
||||
//!
|
||||
//! In this module, a "vector" is any `repr(simd)` type.
|
||||
|
||||
// Temporary macro while we switch the ABI from "platform-intrinsics" to "intrinsics".
|
||||
#[rustfmt::skip]
|
||||
macro_rules! declare_intrinsics {
|
||||
($abi:tt) => {
|
||||
extern $abi {
|
||||
extern "rust-intrinsic" {
|
||||
/// Insert an element into a vector, returning the updated vector.
|
||||
///
|
||||
/// `T` must be a vector with element type `U`.
|
||||
@@ -659,10 +655,3 @@ extern $abi {
|
||||
#[rustc_nounwind]
|
||||
pub fn simd_flog<T>(a: T) -> T;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(bootstrap)]
|
||||
declare_intrinsics!("platform-intrinsic");
|
||||
#[cfg(not(bootstrap))]
|
||||
declare_intrinsics!("rust-intrinsic");
|
||||
|
||||
@@ -112,6 +112,7 @@
|
||||
//
|
||||
// Library features:
|
||||
// tidy-alphabetical-start
|
||||
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
|
||||
#![feature(array_ptr_get)]
|
||||
#![feature(char_indices_offset)]
|
||||
#![feature(const_align_of_val)]
|
||||
@@ -203,12 +204,6 @@
|
||||
//
|
||||
// Language features:
|
||||
// tidy-alphabetical-start
|
||||
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
|
||||
#![cfg_attr(bootstrap, feature(diagnostic_namespace))]
|
||||
#![cfg_attr(bootstrap, feature(exhaustive_patterns))]
|
||||
#![cfg_attr(bootstrap, feature(platform_intrinsics))]
|
||||
#![cfg_attr(not(bootstrap), feature(freeze_impls))]
|
||||
#![cfg_attr(not(bootstrap), feature(min_exhaustive_patterns))]
|
||||
#![feature(abi_unadjusted)]
|
||||
#![feature(adt_const_params)]
|
||||
#![feature(allow_internal_unsafe)]
|
||||
@@ -233,6 +228,7 @@
|
||||
#![feature(doc_notable_trait)]
|
||||
#![feature(effects)]
|
||||
#![feature(extern_types)]
|
||||
#![feature(freeze_impls)]
|
||||
#![feature(fundamental)]
|
||||
#![feature(generic_arg_infer)]
|
||||
#![feature(if_let_guard)]
|
||||
@@ -243,6 +239,7 @@
|
||||
#![feature(let_chains)]
|
||||
#![feature(link_llvm_intrinsics)]
|
||||
#![feature(macro_metavar_expr)]
|
||||
#![feature(min_exhaustive_patterns)]
|
||||
#![feature(min_specialization)]
|
||||
#![feature(multiple_supertrait_upcastable)]
|
||||
#![feature(must_not_suspend)]
|
||||
|
||||
@@ -6,7 +6,7 @@ use crate::marker::ConstParamTy;
|
||||
/// any value of type `Self` are safely transmutable into a value of type `Dst`, in a given `Context`,
|
||||
/// notwithstanding whatever safety checks you have asked the compiler to [`Assume`] are satisfied.
|
||||
#[unstable(feature = "transmutability", issue = "99571")]
|
||||
#[cfg_attr(not(bootstrap), lang = "transmute_trait")]
|
||||
#[lang = "transmute_trait"]
|
||||
#[rustc_deny_explicit_impl(implement_via_object = false)]
|
||||
#[rustc_coinductive]
|
||||
pub unsafe trait BikeshedIntrinsicFrom<Src, const ASSUME: Assume = { Assume::NOTHING }>
|
||||
|
||||
@@ -1153,11 +1153,7 @@ impl f32 {
|
||||
// Stability concerns.
|
||||
unsafe { mem::transmute(x) }
|
||||
}
|
||||
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
|
||||
// SAFETY: We use internal implementations that either always work or fail at compile time.
|
||||
unsafe {
|
||||
intrinsics::const_eval_select((self,), ct_f32_to_u32, rt_f32_to_u32)
|
||||
}
|
||||
intrinsics::const_eval_select((self,), ct_f32_to_u32, rt_f32_to_u32)
|
||||
}
|
||||
|
||||
/// Raw transmutation from `u32`.
|
||||
@@ -1248,11 +1244,7 @@ impl f32 {
|
||||
// Stability concerns.
|
||||
unsafe { mem::transmute(x) }
|
||||
}
|
||||
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
|
||||
// SAFETY: We use internal implementations that either always work or fail at compile time.
|
||||
unsafe {
|
||||
intrinsics::const_eval_select((v,), ct_u32_to_f32, rt_u32_to_f32)
|
||||
}
|
||||
intrinsics::const_eval_select((v,), ct_u32_to_f32, rt_u32_to_f32)
|
||||
}
|
||||
|
||||
/// Return the memory representation of this floating point number as a byte array in
|
||||
|
||||
@@ -1146,11 +1146,7 @@ impl f64 {
|
||||
// Stability concerns.
|
||||
unsafe { mem::transmute::<f64, u64>(rt) }
|
||||
}
|
||||
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
|
||||
// SAFETY: We use internal implementations that either always work or fail at compile time.
|
||||
unsafe {
|
||||
intrinsics::const_eval_select((self,), ct_f64_to_u64, rt_f64_to_u64)
|
||||
}
|
||||
intrinsics::const_eval_select((self,), ct_f64_to_u64, rt_f64_to_u64)
|
||||
}
|
||||
|
||||
/// Raw transmutation from `u64`.
|
||||
@@ -1246,11 +1242,7 @@ impl f64 {
|
||||
// Stability concerns.
|
||||
unsafe { mem::transmute::<u64, f64>(rt) }
|
||||
}
|
||||
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
|
||||
// SAFETY: We use internal implementations that either always work or fail at compile time.
|
||||
unsafe {
|
||||
intrinsics::const_eval_select((v,), ct_u64_to_f64, rt_u64_to_f64)
|
||||
}
|
||||
intrinsics::const_eval_select((v,), ct_u64_to_f64, rt_u64_to_f64)
|
||||
}
|
||||
|
||||
/// Return the memory representation of this floating point number as a byte array in
|
||||
|
||||
@@ -132,7 +132,7 @@ mod internal_implementation_detail {
|
||||
/// and thus either `?0` or `i8`/`i16`/`i32` (see docs for `ClosureKind`
|
||||
/// for an explanation of that). The `GoalKind` is also the same type, but
|
||||
/// representing the kind of the trait that the closure is being called with.
|
||||
#[cfg_attr(not(bootstrap), lang = "async_fn_kind_helper")]
|
||||
#[lang = "async_fn_kind_helper"]
|
||||
trait AsyncFnKindHelper<GoalKind> {
|
||||
// Projects a set of closure inputs (arguments), a region, and a set of upvars
|
||||
// (by move and by ref) to the upvars that we expect the coroutine to have
|
||||
|
||||
@@ -117,11 +117,7 @@ pub const fn panic_nounwind_fmt(fmt: fmt::Arguments<'_>, force_no_backtrace: boo
|
||||
panic_fmt(fmt);
|
||||
}
|
||||
|
||||
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
|
||||
// SAFETY: const panic does not care about unwinding
|
||||
unsafe {
|
||||
super::intrinsics::const_eval_select((fmt, force_no_backtrace), comptime, runtime);
|
||||
}
|
||||
super::intrinsics::const_eval_select((fmt, force_no_backtrace), comptime, runtime);
|
||||
}
|
||||
|
||||
// Next we define a bunch of higher-level wrappers that all bottom out in the two core functions
|
||||
|
||||
@@ -48,12 +48,8 @@ impl<T: ?Sized> *const T {
|
||||
}
|
||||
}
|
||||
|
||||
// on bootstrap bump, remove unsafe block
|
||||
#[cfg_attr(not(bootstrap), allow(unused_unsafe))]
|
||||
// SAFETY: The two versions are equivalent at runtime.
|
||||
unsafe {
|
||||
const_eval_select((self as *const u8,), const_impl, runtime_impl)
|
||||
}
|
||||
#[allow(unused_unsafe)]
|
||||
const_eval_select((self as *const u8,), const_impl, runtime_impl)
|
||||
}
|
||||
|
||||
/// Casts to a pointer of another type.
|
||||
@@ -818,13 +814,8 @@ impl<T: ?Sized> *const T {
|
||||
true
|
||||
}
|
||||
|
||||
#[cfg_attr(not(bootstrap), allow(unused_unsafe))]
|
||||
// on bootstrap bump, remove unsafe block
|
||||
// SAFETY: This function is only used to provide the same check that the const eval
|
||||
// interpreter does at runtime.
|
||||
unsafe {
|
||||
intrinsics::const_eval_select((this, origin), comptime, runtime)
|
||||
}
|
||||
#[allow(unused_unsafe)]
|
||||
intrinsics::const_eval_select((this, origin), comptime, runtime)
|
||||
}
|
||||
|
||||
assert_unsafe_precondition!(
|
||||
@@ -1648,11 +1639,7 @@ impl<T: ?Sized> *const T {
|
||||
// The cast to `()` is used to
|
||||
// 1. deal with fat pointers; and
|
||||
// 2. ensure that `align_offset` (in `const_impl`) doesn't actually try to compute an offset.
|
||||
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
|
||||
// SAFETY: The two versions are equivalent at runtime.
|
||||
unsafe {
|
||||
const_eval_select((self.cast::<()>(), align), const_impl, runtime_impl)
|
||||
}
|
||||
const_eval_select((self.cast::<()>(), align), const_impl, runtime_impl)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,11 +48,7 @@ impl<T: ?Sized> *mut T {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
|
||||
// SAFETY: The two versions are equivalent at runtime.
|
||||
unsafe {
|
||||
const_eval_select((self as *mut u8,), const_impl, runtime_impl)
|
||||
}
|
||||
const_eval_select((self as *mut u8,), const_impl, runtime_impl)
|
||||
}
|
||||
|
||||
/// Casts to a pointer of another type.
|
||||
@@ -1906,11 +1902,7 @@ impl<T: ?Sized> *mut T {
|
||||
// The cast to `()` is used to
|
||||
// 1. deal with fat pointers; and
|
||||
// 2. ensure that `align_offset` (in `const_impl`) doesn't actually try to compute an offset.
|
||||
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
|
||||
// SAFETY: The two versions are equivalent at runtime.
|
||||
unsafe {
|
||||
const_eval_select((self.cast::<()>(), align), const_impl, runtime_impl)
|
||||
}
|
||||
const_eval_select((self.cast::<()>(), align), const_impl, runtime_impl)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,15 +35,7 @@ where
|
||||
#[track_caller]
|
||||
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
|
||||
const fn slice_start_index_len_fail(index: usize, len: usize) -> ! {
|
||||
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
|
||||
// SAFETY: we are just panicking here
|
||||
unsafe {
|
||||
const_eval_select(
|
||||
(index, len),
|
||||
slice_start_index_len_fail_ct,
|
||||
slice_start_index_len_fail_rt,
|
||||
)
|
||||
}
|
||||
const_eval_select((index, len), slice_start_index_len_fail_ct, slice_start_index_len_fail_rt)
|
||||
}
|
||||
|
||||
// FIXME const-hack
|
||||
@@ -64,11 +56,7 @@ const fn slice_start_index_len_fail_ct(_: usize, _: usize) -> ! {
|
||||
#[track_caller]
|
||||
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
|
||||
const fn slice_end_index_len_fail(index: usize, len: usize) -> ! {
|
||||
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
|
||||
// SAFETY: we are just panicking here
|
||||
unsafe {
|
||||
const_eval_select((index, len), slice_end_index_len_fail_ct, slice_end_index_len_fail_rt)
|
||||
}
|
||||
const_eval_select((index, len), slice_end_index_len_fail_ct, slice_end_index_len_fail_rt)
|
||||
}
|
||||
|
||||
// FIXME const-hack
|
||||
@@ -89,11 +77,7 @@ const fn slice_end_index_len_fail_ct(_: usize, _: usize) -> ! {
|
||||
#[track_caller]
|
||||
#[rustc_const_unstable(feature = "const_slice_index", issue = "none")]
|
||||
const fn slice_index_order_fail(index: usize, end: usize) -> ! {
|
||||
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
|
||||
// SAFETY: we are just panicking here
|
||||
unsafe {
|
||||
const_eval_select((index, end), slice_index_order_fail_ct, slice_index_order_fail_rt)
|
||||
}
|
||||
const_eval_select((index, end), slice_index_order_fail_ct, slice_index_order_fail_rt)
|
||||
}
|
||||
|
||||
// FIXME const-hack
|
||||
|
||||
@@ -86,15 +86,7 @@ use iter::{MatchesInternal, SplitNInternal};
|
||||
#[rustc_allow_const_fn_unstable(const_eval_select)]
|
||||
#[cfg(not(feature = "panic_immediate_abort"))]
|
||||
const fn slice_error_fail(s: &str, begin: usize, end: usize) -> ! {
|
||||
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
|
||||
// SAFETY: panics for both branches
|
||||
unsafe {
|
||||
crate::intrinsics::const_eval_select(
|
||||
(s, begin, end),
|
||||
slice_error_fail_ct,
|
||||
slice_error_fail_rt,
|
||||
)
|
||||
}
|
||||
crate::intrinsics::const_eval_select((s, begin, end), slice_error_fail_ct, slice_error_fail_rt)
|
||||
}
|
||||
|
||||
#[cfg(feature = "panic_immediate_abort")]
|
||||
|
||||
Reference in New Issue
Block a user