Skip to content

Commit dd7927a

Browse files
committed
Auto merge of rust-lang#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
2 parents f8ec29c + 62fb165 commit dd7927a

File tree

24 files changed

+50
-183
lines changed

24 files changed

+50
-183
lines changed

alloc/src/alloc.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ extern "Rust" {
5151
#[derive(Copy, Clone, Default, Debug)]
5252
#[cfg(not(test))]
5353
// the compiler needs to know when a Box uses the global allocator vs a custom one
54-
#[cfg_attr(not(bootstrap), lang = "global_alloc_ty")]
54+
#[lang = "global_alloc_ty"]
5555
pub struct Global;
5656

5757
#[cfg(test)]
@@ -387,8 +387,7 @@ pub const fn handle_alloc_error(layout: Layout) -> ! {
387387
}
388388

389389
#[cfg(not(feature = "panic_immediate_abort"))]
390-
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
391-
unsafe {
390+
{
392391
core::intrinsics::const_eval_select((layout,), ct_error, rt_error)
393392
}
394393

core/src/convert/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ pub trait AsMut<T: ?Sized> {
396396
/// For example, take this code:
397397
///
398398
/// ```
399-
/// # #![cfg_attr(not(bootstrap), allow(non_local_definitions))]
399+
/// # #![allow(non_local_definitions)]
400400
/// struct Wrapper<T>(Vec<T>);
401401
/// impl<T> From<Wrapper<T>> for Vec<T> {
402402
/// fn from(w: Wrapper<T>) -> Vec<T> {

core/src/ffi/c_str.rs

+2-12
Original file line numberDiff line numberDiff line change
@@ -438,13 +438,7 @@ impl CStr {
438438
unsafe { &*(bytes as *const [u8] as *const CStr) }
439439
}
440440

441-
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
442-
// SAFETY: The const and runtime versions have identical behavior
443-
// unless the safety contract of `from_bytes_with_nul_unchecked` is
444-
// violated, which is UB.
445-
unsafe {
446-
intrinsics::const_eval_select((bytes,), const_impl, rt_impl)
447-
}
441+
intrinsics::const_eval_select((bytes,), const_impl, rt_impl)
448442
}
449443

450444
/// Returns the inner pointer to this C string.
@@ -759,11 +753,7 @@ const unsafe fn const_strlen(ptr: *const c_char) -> usize {
759753
unsafe { strlen(s) }
760754
}
761755

762-
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
763-
// SAFETY: the two functions always provide equivalent functionality
764-
unsafe {
765-
intrinsics::const_eval_select((ptr,), strlen_ct, strlen_rt)
766-
}
756+
intrinsics::const_eval_select((ptr,), strlen_ct, strlen_rt)
767757
}
768758

769759
/// An iterator over the bytes of a [`CStr`], without the nul terminator.

core/src/hash/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ pub trait Hasher {
454454
/// ```
455455
/// #![feature(hasher_prefixfree_extras)]
456456
/// # // Stubs to make the `impl` below pass the compiler
457-
/// # #![cfg_attr(not(bootstrap), allow(non_local_definitions))]
457+
/// # #![allow(non_local_definitions)]
458458
/// # struct MyCollection<T>(Option<T>);
459459
/// # impl<T> MyCollection<T> {
460460
/// # fn len(&self) -> usize { todo!() }

core/src/intrinsics.rs

+14-53
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@ pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
8484
unsafe { crate::ptr::drop_in_place(to_drop) }
8585
}
8686

87-
#[cfg(bootstrap)]
88-
pub use self::r#try as catch_unwind;
89-
9087
extern "rust-intrinsic" {
9188
// N.B., these intrinsics take raw pointers because they mutate aliased
9289
// memory, which is not valid for either `&` or `&mut`.
@@ -965,8 +962,7 @@ extern "rust-intrinsic" {
965962
#[rustc_const_stable(feature = "const_assume", since = "1.77.0")]
966963
#[rustc_nounwind]
967964
#[unstable(feature = "core_intrinsics", issue = "none")]
968-
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
969-
#[cfg_attr(bootstrap, inline)]
965+
#[rustc_intrinsic]
970966
pub const unsafe fn assume(b: bool) {
971967
if !b {
972968
// SAFETY: the caller must guarantee the argument is never `false`
@@ -987,9 +983,8 @@ pub const unsafe fn assume(b: bool) {
987983
/// This intrinsic does not have a stable counterpart.
988984
#[rustc_const_unstable(feature = "const_likely", issue = "none")]
989985
#[unstable(feature = "core_intrinsics", issue = "none")]
990-
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
986+
#[rustc_intrinsic]
991987
#[rustc_nounwind]
992-
#[cfg_attr(bootstrap, inline)]
993988
pub const fn likely(b: bool) -> bool {
994989
b
995990
}
@@ -1007,9 +1002,8 @@ pub const fn likely(b: bool) -> bool {
10071002
/// This intrinsic does not have a stable counterpart.
10081003
#[rustc_const_unstable(feature = "const_likely", issue = "none")]
10091004
#[unstable(feature = "core_intrinsics", issue = "none")]
1010-
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
1005+
#[rustc_intrinsic]
10111006
#[rustc_nounwind]
1012-
#[cfg_attr(bootstrap, inline)]
10131007
pub const fn unlikely(b: bool) -> bool {
10141008
b
10151009
}
@@ -1919,39 +1913,34 @@ extern "rust-intrinsic" {
19191913
/// This intrinsic does not have a stable counterpart.
19201914
#[rustc_nounwind]
19211915
#[rustc_safe_intrinsic]
1922-
#[cfg(not(bootstrap))]
19231916
pub fn fadd_algebraic<T: Copy>(a: T, b: T) -> T;
19241917

19251918
/// Float subtraction that allows optimizations based on algebraic rules.
19261919
///
19271920
/// This intrinsic does not have a stable counterpart.
19281921
#[rustc_nounwind]
19291922
#[rustc_safe_intrinsic]
1930-
#[cfg(not(bootstrap))]
19311923
pub fn fsub_algebraic<T: Copy>(a: T, b: T) -> T;
19321924

19331925
/// Float multiplication that allows optimizations based on algebraic rules.
19341926
///
19351927
/// This intrinsic does not have a stable counterpart.
19361928
#[rustc_nounwind]
19371929
#[rustc_safe_intrinsic]
1938-
#[cfg(not(bootstrap))]
19391930
pub fn fmul_algebraic<T: Copy>(a: T, b: T) -> T;
19401931

19411932
/// Float division that allows optimizations based on algebraic rules.
19421933
///
19431934
/// This intrinsic does not have a stable counterpart.
19441935
#[rustc_nounwind]
19451936
#[rustc_safe_intrinsic]
1946-
#[cfg(not(bootstrap))]
19471937
pub fn fdiv_algebraic<T: Copy>(a: T, b: T) -> T;
19481938

19491939
/// Float remainder that allows optimizations based on algebraic rules.
19501940
///
19511941
/// This intrinsic does not have a stable counterpart.
19521942
#[rustc_nounwind]
19531943
#[rustc_safe_intrinsic]
1954-
#[cfg(not(bootstrap))]
19551944
pub fn frem_algebraic<T: Copy>(a: T, b: T) -> T;
19561945

19571946
/// Convert with LLVM’s fptoui/fptosi, which may return undef for values out of range
@@ -2407,14 +2396,8 @@ extern "rust-intrinsic" {
24072396
///
24082397
/// The stable version of this intrinsic is `std::panic::catch_unwind`.
24092398
#[rustc_nounwind]
2410-
#[cfg(not(bootstrap))]
24112399
pub fn catch_unwind(try_fn: fn(*mut u8), data: *mut u8, catch_fn: fn(*mut u8, *mut u8)) -> i32;
24122400

2413-
/// For bootstrap only, see `catch_unwind`.
2414-
#[rustc_nounwind]
2415-
#[cfg(bootstrap)]
2416-
pub fn r#try(try_fn: fn(*mut u8), data: *mut u8, catch_fn: fn(*mut u8, *mut u8)) -> i32;
2417-
24182401
/// Emits a `!nontemporal` store according to LLVM (see their docs).
24192402
/// Probably will never become stable.
24202403
///
@@ -2518,9 +2501,9 @@ extern "rust-intrinsic" {
25182501
#[cfg(bootstrap)]
25192502
pub fn vtable_align(ptr: *const ()) -> usize;
25202503

2521-
#[cfg(bootstrap)]
25222504
#[rustc_const_unstable(feature = "const_eval_select", issue = "none")]
2523-
#[cfg_attr(not(bootstrap), rustc_safe_intrinsic)]
2505+
#[rustc_safe_intrinsic]
2506+
#[cfg(bootstrap)]
25242507
pub fn const_eval_select<ARG: Tuple, F, G, RET>(
25252508
arg: ARG,
25262509
called_in_const: F,
@@ -2650,8 +2633,7 @@ where
26502633
#[rustc_const_unstable(feature = "is_val_statically_known", issue = "none")]
26512634
#[rustc_nounwind]
26522635
#[unstable(feature = "core_intrinsics", issue = "none")]
2653-
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
2654-
#[cfg_attr(bootstrap, inline)]
2636+
#[rustc_intrinsic]
26552637
pub const fn is_val_statically_known<T: Copy>(_arg: T) -> bool {
26562638
false
26572639
}
@@ -2670,7 +2652,7 @@ pub const fn is_val_statically_known<T: Copy>(_arg: T) -> bool {
26702652
#[rustc_const_unstable(feature = "ub_checks", issue = "none")]
26712653
#[unstable(feature = "core_intrinsics", issue = "none")]
26722654
#[inline(always)]
2673-
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
2655+
#[rustc_intrinsic]
26742656
pub(crate) const fn check_library_ub() -> bool {
26752657
cfg!(debug_assertions)
26762658
}
@@ -2686,7 +2668,7 @@ pub(crate) const fn check_library_ub() -> bool {
26862668
#[rustc_const_unstable(feature = "ub_checks", issue = "none")]
26872669
#[unstable(feature = "core_intrinsics", issue = "none")]
26882670
#[inline(always)]
2689-
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
2671+
#[rustc_intrinsic]
26902672
pub(crate) const fn check_language_ub() -> bool {
26912673
cfg!(debug_assertions)
26922674
}
@@ -2702,8 +2684,7 @@ pub(crate) const fn check_language_ub() -> bool {
27022684
#[rustc_const_unstable(feature = "const_heap", issue = "79597")]
27032685
#[unstable(feature = "core_intrinsics", issue = "none")]
27042686
#[rustc_nounwind]
2705-
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
2706-
#[cfg_attr(bootstrap, inline)]
2687+
#[rustc_intrinsic]
27072688
pub const unsafe fn const_allocate(_size: usize, _align: usize) -> *mut u8 {
27082689
// const eval overrides this function, but runtime code should always just return null pointers.
27092690
crate::ptr::null_mut()
@@ -2722,8 +2703,7 @@ pub const unsafe fn const_allocate(_size: usize, _align: usize) -> *mut u8 {
27222703
#[rustc_const_unstable(feature = "const_heap", issue = "79597")]
27232704
#[unstable(feature = "core_intrinsics", issue = "none")]
27242705
#[rustc_nounwind]
2725-
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
2726-
#[cfg_attr(bootstrap, inline)]
2706+
#[rustc_intrinsic]
27272707
pub const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
27282708

27292709
/// `ptr` must point to a vtable.
@@ -2799,15 +2779,6 @@ pub unsafe fn vtable_align(_ptr: *const ()) -> usize {
27992779
macro_rules! assert_unsafe_precondition {
28002780
($kind:ident, $message:expr, ($($name:ident:$ty:ty = $arg:expr),*$(,)?) => $e:expr $(,)?) => {
28012781
{
2802-
// #[cfg(bootstrap)] (this comment)
2803-
// When the standard library is compiled with debug assertions, we want the check to inline for better performance.
2804-
// This is important when working on the compiler, which is compiled with debug assertions locally.
2805-
// When not compiled with debug assertions (so the precompiled std) we outline the check to minimize the compile
2806-
// time impact when debug assertions are disabled.
2807-
// The proper solution to this is the `#[rustc_no_mir_inline]` below, but we still want decent performance for cfg(bootstrap).
2808-
#[cfg_attr(all(debug_assertions, bootstrap), inline(always))]
2809-
#[cfg_attr(all(not(debug_assertions), bootstrap), inline(never))]
2810-
28112782
// This check is inlineable, but not by the MIR inliner.
28122783
// The reason for this is that the MIR inliner is in an exceptionally bad position
28132784
// 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 {
28162787
//
28172788
// LLVM on the other hand sees the constant branch, so if it's `false`, it can immediately delete it without
28182789
// inlining the check. If it's `true`, it can inline it and get significantly better performance.
2819-
#[cfg_attr(not(bootstrap), rustc_no_mir_inline)]
2820-
#[cfg_attr(not(bootstrap), inline)]
2790+
#[rustc_no_mir_inline]
2791+
#[inline]
28212792
#[rustc_nounwind]
28222793
#[rustc_const_unstable(feature = "ub_checks", issue = "none")]
28232794
const fn precondition_check($($name:$ty),*) {
@@ -2885,13 +2856,7 @@ pub(crate) const fn is_nonoverlapping(
28852856
true
28862857
}
28872858

2888-
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
2889-
// SAFETY: This function's precondition is equivalent to that of `const_eval_select`.
2890-
// Programs which do not execute UB will only see this function return `true`, which makes the
2891-
// const and runtime implementation indistinguishable.
2892-
unsafe {
2893-
const_eval_select((src, dst, size, count), comptime, runtime)
2894-
}
2859+
const_eval_select((src, dst, size, count), comptime, runtime)
28952860
}
28962861

28972862
/// 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
32083173

32093174
const fn compiletime(_ptr: *const (), _align: usize) {}
32103175

3211-
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
3212-
// SAFETY: the extra behavior at runtime is for UB checks only.
3213-
unsafe {
3214-
const_eval_select((ptr, align), compiletime, runtime);
3215-
}
3176+
const_eval_select((ptr, align), compiletime, runtime);
32163177
}

core/src/intrinsics/simd.rs

+1-12
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22
//!
33
//! In this module, a "vector" is any `repr(simd)` type.
44
5-
// Temporary macro while we switch the ABI from "platform-intrinsics" to "intrinsics".
6-
#[rustfmt::skip]
7-
macro_rules! declare_intrinsics {
8-
($abi:tt) => {
9-
extern $abi {
5+
extern "rust-intrinsic" {
106
/// Insert an element into a vector, returning the updated vector.
117
///
128
/// `T` must be a vector with element type `U`.
@@ -659,10 +655,3 @@ extern $abi {
659655
#[rustc_nounwind]
660656
pub fn simd_flog<T>(a: T) -> T;
661657
}
662-
}
663-
}
664-
665-
#[cfg(bootstrap)]
666-
declare_intrinsics!("platform-intrinsic");
667-
#[cfg(not(bootstrap))]
668-
declare_intrinsics!("rust-intrinsic");

core/src/lib.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
//
113113
// Library features:
114114
// tidy-alphabetical-start
115+
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
115116
#![feature(array_ptr_get)]
116117
#![feature(char_indices_offset)]
117118
#![feature(const_align_of_val)]
@@ -203,12 +204,6 @@
203204
//
204205
// Language features:
205206
// tidy-alphabetical-start
206-
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
207-
#![cfg_attr(bootstrap, feature(diagnostic_namespace))]
208-
#![cfg_attr(bootstrap, feature(exhaustive_patterns))]
209-
#![cfg_attr(bootstrap, feature(platform_intrinsics))]
210-
#![cfg_attr(not(bootstrap), feature(freeze_impls))]
211-
#![cfg_attr(not(bootstrap), feature(min_exhaustive_patterns))]
212207
#![feature(abi_unadjusted)]
213208
#![feature(adt_const_params)]
214209
#![feature(allow_internal_unsafe)]
@@ -233,6 +228,7 @@
233228
#![feature(doc_notable_trait)]
234229
#![feature(effects)]
235230
#![feature(extern_types)]
231+
#![feature(freeze_impls)]
236232
#![feature(fundamental)]
237233
#![feature(generic_arg_infer)]
238234
#![feature(if_let_guard)]
@@ -243,6 +239,7 @@
243239
#![feature(let_chains)]
244240
#![feature(link_llvm_intrinsics)]
245241
#![feature(macro_metavar_expr)]
242+
#![feature(min_exhaustive_patterns)]
246243
#![feature(min_specialization)]
247244
#![feature(multiple_supertrait_upcastable)]
248245
#![feature(must_not_suspend)]

core/src/mem/transmutability.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::marker::ConstParamTy;
66
/// any value of type `Self` are safely transmutable into a value of type `Dst`, in a given `Context`,
77
/// notwithstanding whatever safety checks you have asked the compiler to [`Assume`] are satisfied.
88
#[unstable(feature = "transmutability", issue = "99571")]
9-
#[cfg_attr(not(bootstrap), lang = "transmute_trait")]
9+
#[lang = "transmute_trait"]
1010
#[rustc_deny_explicit_impl(implement_via_object = false)]
1111
#[rustc_coinductive]
1212
pub unsafe trait BikeshedIntrinsicFrom<Src, const ASSUME: Assume = { Assume::NOTHING }>

core/src/num/f32.rs

+2-10
Original file line numberDiff line numberDiff line change
@@ -1153,11 +1153,7 @@ impl f32 {
11531153
// Stability concerns.
11541154
unsafe { mem::transmute(x) }
11551155
}
1156-
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
1157-
// SAFETY: We use internal implementations that either always work or fail at compile time.
1158-
unsafe {
1159-
intrinsics::const_eval_select((self,), ct_f32_to_u32, rt_f32_to_u32)
1160-
}
1156+
intrinsics::const_eval_select((self,), ct_f32_to_u32, rt_f32_to_u32)
11611157
}
11621158

11631159
/// Raw transmutation from `u32`.
@@ -1248,11 +1244,7 @@ impl f32 {
12481244
// Stability concerns.
12491245
unsafe { mem::transmute(x) }
12501246
}
1251-
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
1252-
// SAFETY: We use internal implementations that either always work or fail at compile time.
1253-
unsafe {
1254-
intrinsics::const_eval_select((v,), ct_u32_to_f32, rt_u32_to_f32)
1255-
}
1247+
intrinsics::const_eval_select((v,), ct_u32_to_f32, rt_u32_to_f32)
12561248
}
12571249

12581250
/// Return the memory representation of this floating point number as a byte array in

core/src/num/f64.rs

+2-10
Original file line numberDiff line numberDiff line change
@@ -1146,11 +1146,7 @@ impl f64 {
11461146
// Stability concerns.
11471147
unsafe { mem::transmute::<f64, u64>(rt) }
11481148
}
1149-
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
1150-
// SAFETY: We use internal implementations that either always work or fail at compile time.
1151-
unsafe {
1152-
intrinsics::const_eval_select((self,), ct_f64_to_u64, rt_f64_to_u64)
1153-
}
1149+
intrinsics::const_eval_select((self,), ct_f64_to_u64, rt_f64_to_u64)
11541150
}
11551151

11561152
/// Raw transmutation from `u64`.
@@ -1246,11 +1242,7 @@ impl f64 {
12461242
// Stability concerns.
12471243
unsafe { mem::transmute::<u64, f64>(rt) }
12481244
}
1249-
#[cfg_attr(not(bootstrap), allow(unused_unsafe))] // on bootstrap bump, remove unsafe block
1250-
// SAFETY: We use internal implementations that either always work or fail at compile time.
1251-
unsafe {
1252-
intrinsics::const_eval_select((v,), ct_u64_to_f64, rt_u64_to_f64)
1253-
}
1245+
intrinsics::const_eval_select((v,), ct_u64_to_f64, rt_u64_to_f64)
12541246
}
12551247

12561248
/// Return the memory representation of this floating point number as a byte array in

0 commit comments

Comments
 (0)