Skip to content

Commit 21a5e60

Browse files
committed
Auto merge of rust-lang#121345 - Nilstrieb:rollup-reb0xge, r=Nilstrieb
Rollup of 8 pull requests Successful merges: - rust-lang#121167 (resolve: Scale back unloading of speculatively loaded crates) - rust-lang#121196 (Always inline check in `assert_unsafe_precondition` with cfg(debug_assertions)) - rust-lang#121241 (Implement `NonZero` traits generically.) - rust-lang#121278 (Remove the "codegen" profile from bootstrap) - rust-lang#121286 (Rename `ConstPropLint` to `KnownPanicsLint`) - rust-lang#121291 (target: Revert default to the medium code model on LoongArch targets) - rust-lang#121302 (Remove `RefMutL` hack in `proc_macro::bridge`) - rust-lang#121318 (Trigger `unsafe_code` lint on invocations of `global_asm`) Failed merges: - rust-lang#121206 (Top level error handling) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 37a66b0 + f06f11f commit 21a5e60

File tree

4 files changed

+222
-206
lines changed

4 files changed

+222
-206
lines changed

core/src/intrinsics.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -2575,6 +2575,7 @@ pub const fn is_val_statically_known<T: Copy>(_arg: T) -> bool {
25752575
/// assertions disabled. This intrinsic is primarily used by [`assert_unsafe_precondition`].
25762576
#[rustc_const_unstable(feature = "delayed_debug_assertions", issue = "none")]
25772577
#[unstable(feature = "core_intrinsics", issue = "none")]
2578+
#[inline(always)]
25782579
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
25792580
pub(crate) const fn debug_assertions() -> bool {
25802581
cfg!(debug_assertions)
@@ -2659,7 +2660,13 @@ pub const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize)
26592660
macro_rules! assert_unsafe_precondition {
26602661
($message:expr, ($($name:ident:$ty:ty = $arg:expr),*$(,)?) => $e:expr $(,)?) => {
26612662
{
2662-
#[inline(never)]
2663+
// When the standard library is compiled with debug assertions, we want the check to inline for better performance.
2664+
// This is important when working on the compiler, which is compiled with debug assertions locally.
2665+
// When not compiled with debug assertions (so the precompiled std) we outline the check to minimize the compile
2666+
// time impact when debug assertions are disabled.
2667+
// It is not clear whether that is the best solution, see #120848.
2668+
#[cfg_attr(debug_assertions, inline(always))]
2669+
#[cfg_attr(not(debug_assertions), inline(never))]
26632670
#[rustc_nounwind]
26642671
fn precondition_check($($name:$ty),*) {
26652672
if !$e {

0 commit comments

Comments
 (0)