step cfgs
This commit is contained in:
parent
e4c58eb8da
commit
02f1930595
@ -16,7 +16,6 @@
|
||||
#![feature(box_patterns)]
|
||||
#![feature(if_let_guard)]
|
||||
#![feature(let_chains)]
|
||||
#![cfg_attr(bootstrap, feature(min_specialization))]
|
||||
#![feature(never_type)]
|
||||
#![feature(negative_impls)]
|
||||
#![feature(stmt_expr_attributes)]
|
||||
|
@ -7,7 +7,6 @@
|
||||
#![allow(internal_features)]
|
||||
#![allow(rustc::diagnostic_outside_of_impl)]
|
||||
#![allow(rustc::untranslatable_diagnostic)]
|
||||
#![cfg_attr(bootstrap, feature(min_specialization))]
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(array_windows)]
|
||||
|
@ -5,7 +5,6 @@
|
||||
#![feature(associated_type_defaults)]
|
||||
#![feature(closure_track_caller)]
|
||||
#![feature(let_chains)]
|
||||
#![cfg_attr(bootstrap, feature(min_specialization))]
|
||||
#![feature(never_type)]
|
||||
#![feature(rustc_attrs)]
|
||||
#![feature(variant_count)]
|
||||
|
@ -68,7 +68,6 @@
|
||||
#![feature(is_sorted)]
|
||||
#![feature(iter_intersperse)]
|
||||
#![feature(let_chains)]
|
||||
#![cfg_attr(bootstrap, feature(min_specialization))]
|
||||
#![feature(never_type)]
|
||||
#![feature(lazy_cell)]
|
||||
#![feature(slice_partition_dedup)]
|
||||
|
@ -5,7 +5,6 @@
|
||||
#![feature(try_blocks)]
|
||||
#![feature(never_type)]
|
||||
#![feature(box_patterns)]
|
||||
#![cfg_attr(bootstrap, feature(min_specialization))]
|
||||
#![feature(control_flow_enum)]
|
||||
|
||||
#[macro_use]
|
||||
|
@ -25,7 +25,6 @@
|
||||
#![feature(let_chains)]
|
||||
#![feature(if_let_guard)]
|
||||
#![feature(iterator_try_collect)]
|
||||
#![cfg_attr(bootstrap, feature(min_specialization))]
|
||||
#![feature(try_blocks)]
|
||||
#![recursion_limit = "512"] // For rustdoc
|
||||
|
||||
|
@ -24,8 +24,7 @@
|
||||
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![doc(rust_logo)]
|
||||
#![cfg_attr(bootstrap, feature(exhaustive_patterns))]
|
||||
#![cfg_attr(not(bootstrap), feature(min_exhaustive_patterns))]
|
||||
#![feature(min_exhaustive_patterns)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![feature(allocator_api)]
|
||||
#![feature(array_windows)]
|
||||
|
@ -9,7 +9,6 @@
|
||||
#![feature(box_patterns)]
|
||||
#![feature(if_let_guard)]
|
||||
#![feature(let_chains)]
|
||||
#![cfg_attr(bootstrap, feature(min_specialization))]
|
||||
#![feature(try_blocks)]
|
||||
|
||||
#[macro_use]
|
||||
|
@ -2,7 +2,6 @@
|
||||
#![feature(box_patterns)]
|
||||
#![feature(exact_size_is_empty)]
|
||||
#![feature(let_chains)]
|
||||
#![cfg_attr(bootstrap, feature(min_specialization))]
|
||||
#![feature(try_blocks)]
|
||||
|
||||
#[macro_use]
|
||||
|
@ -8,7 +8,6 @@
|
||||
#![feature(is_sorted)]
|
||||
#![feature(let_chains)]
|
||||
#![feature(map_try_insert)]
|
||||
#![cfg_attr(bootstrap, feature(min_specialization))]
|
||||
#![feature(never_type)]
|
||||
#![feature(option_get_or_insert_default)]
|
||||
#![feature(round_char_boundary)]
|
||||
|
@ -9,13 +9,11 @@
|
||||
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![doc(rust_logo)]
|
||||
#![cfg_attr(bootstrap, feature(exhaustive_patterns))]
|
||||
#![cfg_attr(not(bootstrap), feature(min_exhaustive_patterns))]
|
||||
#![feature(min_exhaustive_patterns)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![feature(assert_matches)]
|
||||
#![feature(iter_intersperse)]
|
||||
#![feature(let_chains)]
|
||||
#![cfg_attr(bootstrap, feature(min_specialization))]
|
||||
#![feature(rustc_attrs)]
|
||||
#![feature(step_trait)]
|
||||
#![allow(internal_features)]
|
||||
|
@ -26,7 +26,6 @@
|
||||
#![feature(option_take_if)]
|
||||
#![feature(never_type)]
|
||||
#![feature(type_alias_impl_trait)]
|
||||
#![cfg_attr(bootstrap, feature(min_specialization))]
|
||||
#![recursion_limit = "512"] // For rustdoc
|
||||
|
||||
#[macro_use]
|
||||
|
@ -51,7 +51,7 @@
|
||||
#[derive(Copy, Clone, Default, Debug)]
|
||||
#[cfg(not(test))]
|
||||
// the compiler needs to know when a Box uses the global allocator vs a custom one
|
||||
#[cfg_attr(not(bootstrap), lang = "global_alloc_ty")]
|
||||
#[lang = "global_alloc_ty"]
|
||||
pub struct Global;
|
||||
|
||||
#[cfg(test)]
|
||||
@ -387,8 +387,7 @@ fn rt_error(layout: Layout) -> ! {
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "panic_immediate_abort"))]
|
||||
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
|
||||
unsafe {
|
||||
{
|
||||
core::intrinsics::const_eval_select((layout,), ct_error, rt_error)
|
||||
}
|
||||
|
||||
|
@ -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 @@ const fn const_impl(bytes: &[u8]) -> &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 @@ fn strlen_rt(s: *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 @@ fn write_isize(&mut self, i: isize) {
|
||||
/// ```
|
||||
/// #![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 @@ pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
|
||||
#[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 unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
|
||||
/// 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 @@ pub const fn unlikely(b: bool) -> bool {
|
||||
/// 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 @@ pub const fn unlikely(b: bool) -> bool {
|
||||
/// 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 @@ pub const fn unlikely(b: bool) -> bool {
|
||||
/// 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 @@ pub const fn unlikely(b: bool) -> bool {
|
||||
/// 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 @@ pub const fn unlikely(b: bool) -> bool {
|
||||
/// 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 @@ pub const fn unlikely(b: bool) -> bool {
|
||||
///
|
||||
/// 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 @@ pub const fn ptr_guaranteed_cmp<T>(ptr: *const T, other: *const T) -> u8 {
|
||||
#[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 @@ pub const fn const_eval_select<ARG: Tuple, F, G, RET>(
|
||||
#[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(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_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 @@ const fn comptime(_: *const (), _: *const (), _: usize, _: usize) -> bool {
|
||||
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 @@ fn runtime(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 @@ macro_rules! declare_intrinsics {
|
||||
#[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 @@
|
||||
/// 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 @@ fn rt_f32_to_u32(x: f32) -> u32 {
|
||||
// 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 @@ fn rt_u32_to_f32(x: u32) -> 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 @@ fn rt_f64_to_u64(rt: f64) -> u64 {
|
||||
// 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 @@ fn rt_u64_to_f64(rt: u64) -> 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
|
||||
|
@ -140,7 +140,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 @@ const fn comptime(fmt: fmt::Arguments<'_>, _force_no_backtrace: bool) -> ! {
|
||||
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 @@ const fn const_impl(ptr: *const u8) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
// 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 @@ const fn comptime(_: *const (), _: *const ()) -> bool {
|
||||
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 @@ const fn const_impl(ptr: *const (), align: usize) -> bool {
|
||||
// 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 @@ const fn const_impl(ptr: *mut u8) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
#[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 @@ const fn const_impl(ptr: *mut (), align: usize) -> bool {
|
||||
// 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 @@ fn index_mut(&mut self, index: I) -> &mut I::Output {
|
||||
#[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 @@
|
||||
#[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")]
|
||||
|
@ -49,7 +49,7 @@ fn test_iterator_step_by_nth() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(not(bootstrap), allow(non_local_definitions))]
|
||||
#[allow(non_local_definitions)]
|
||||
fn test_iterator_step_by_nth_overflow() {
|
||||
#[cfg(target_pointer_width = "16")]
|
||||
type Bigger = u32;
|
||||
|
@ -195,7 +195,7 @@ pub fn test_unwrap_or_default() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(not(bootstrap), allow(non_local_definitions))]
|
||||
#[allow(non_local_definitions)]
|
||||
pub fn test_into_ok() {
|
||||
fn infallible_op() -> Result<isize, !> {
|
||||
Ok(666)
|
||||
@ -218,7 +218,7 @@ fn infallible_op2() -> Result<isize, MyNeverToken> {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(not(bootstrap), allow(non_local_definitions))]
|
||||
#[allow(non_local_definitions)]
|
||||
pub fn test_into_err() {
|
||||
fn until_error_op() -> Result<!, isize> {
|
||||
Err(666)
|
||||
|
@ -270,9 +270,6 @@
|
||||
//
|
||||
// Language features:
|
||||
// tidy-alphabetical-start
|
||||
#![cfg_attr(bootstrap, feature(exhaustive_patterns))]
|
||||
#![cfg_attr(bootstrap, feature(platform_intrinsics))]
|
||||
#![cfg_attr(not(bootstrap), feature(min_exhaustive_patterns))]
|
||||
#![feature(alloc_error_handler)]
|
||||
#![feature(allocator_internals)]
|
||||
#![feature(allow_internal_unsafe)]
|
||||
@ -297,6 +294,7 @@
|
||||
#![feature(let_chains)]
|
||||
#![feature(link_cfg)]
|
||||
#![feature(linkage)]
|
||||
#![feature(min_exhaustive_patterns)]
|
||||
#![feature(min_specialization)]
|
||||
#![feature(must_not_suspend)]
|
||||
#![feature(needs_panic_runtime)]
|
||||
|
@ -12,8 +12,7 @@
|
||||
#[inline] // see comments below
|
||||
#[deny(unsafe_op_in_unsafe_fn)]
|
||||
// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint
|
||||
#[cfg_attr(bootstrap, allow(static_mut_ref))]
|
||||
#[cfg_attr(not(bootstrap), allow(static_mut_refs))]
|
||||
#[allow(static_mut_refs)]
|
||||
unsafe fn __getit(
|
||||
_init: $crate::option::Option<&mut $crate::option::Option<$t>>,
|
||||
) -> $crate::option::Option<&'static $t> {
|
||||
|
@ -3,7 +3,6 @@
|
||||
#![feature(link_cfg)]
|
||||
#![feature(staged_api)]
|
||||
#![feature(c_unwind)]
|
||||
#![cfg_attr(bootstrap, feature(cfg_target_abi))]
|
||||
#![feature(strict_provenance)]
|
||||
#![cfg_attr(not(target_env = "msvc"), feature(libc))]
|
||||
#![cfg_attr(
|
||||
|
@ -537,15 +537,9 @@ fn wasm_special() {
|
||||
("wasm32-wasi", "wasm32", true),
|
||||
("wasm32-wasi", "wasm32-bare", false),
|
||||
("wasm32-wasi", "wasi", true),
|
||||
// NB: the wasm32-wasip1 target is new so this isn't tested for
|
||||
// the bootstrap compiler.
|
||||
#[cfg(not(bootstrap))]
|
||||
("wasm32-wasip1", "emscripten", false),
|
||||
#[cfg(not(bootstrap))]
|
||||
("wasm32-wasip1", "wasm32", true),
|
||||
#[cfg(not(bootstrap))]
|
||||
("wasm32-wasip1", "wasm32-bare", false),
|
||||
#[cfg(not(bootstrap))]
|
||||
("wasm32-wasip1", "wasi", true),
|
||||
("wasm64-unknown-unknown", "emscripten", false),
|
||||
("wasm64-unknown-unknown", "wasm32", false),
|
||||
@ -604,11 +598,8 @@ fn threads_support() {
|
||||
("aarch64-apple-darwin", true),
|
||||
("wasm32-unknown-unknown", false),
|
||||
("wasm64-unknown-unknown", false),
|
||||
#[cfg(not(bootstrap))]
|
||||
("wasm32-wasip1", false),
|
||||
#[cfg(not(bootstrap))]
|
||||
("wasm32-wasip1-threads", true),
|
||||
("wasm32-wasi-preview1-threads", true),
|
||||
];
|
||||
for (target, has_threads) in threads {
|
||||
let config = cfg().target(target).build();
|
||||
|
@ -66,7 +66,7 @@ fn ensure_real_path(filename: &FileName) -> &Path {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(not(bootstrap), allow(non_local_definitions))]
|
||||
#[allow(non_local_definitions)]
|
||||
impl From<&FileName> for rustc_span::FileName {
|
||||
fn from(filename: &FileName) -> rustc_span::FileName {
|
||||
match filename {
|
||||
|
Loading…
Reference in New Issue
Block a user