1
Fork 0

Auto merge of #121114 - Nilstrieb:no-inline!, r=saethlin

Add `#[rustc_no_mir_inline]` for standard library UB checks

should help with #121110 and also with #120848

Because the MIR inliner cannot know whether the checks are enabled or not, so inlining is an unnecessary compile time pessimization when debug assertions are disabled. LLVM knows whether they are enabled or not, so it can optimize accordingly without wasting time.

r? `@saethlin`
This commit is contained in:
bors 2024-02-25 03:47:31 +00:00
commit e9f9594913
9 changed files with 107 additions and 3 deletions

View file

@ -792,6 +792,10 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
rustc_intrinsic, Normal, template!(Word), ErrorFollowing,
"the `#[rustc_intrinsic]` attribute is used to declare intrinsics with function bodies",
),
rustc_attr!(
rustc_no_mir_inline, Normal, template!(Word), WarnFollowing,
"#[rustc_no_mir_inline] prevents the MIR inliner from inlining a function while not affecting codegen"
),
// ==========================================================================
// Internal attributes, Testing: