diff options
| author | bors <bors@rust-lang.org> | 2024-02-25 03:47:31 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-02-25 03:47:31 +0000 |
| commit | e9f95949138125bb1b98ed213a41b9aa825bacf5 (patch) | |
| tree | 62e8ea3486b3a9c88f1435c080bb926fb8e4bc8f /compiler/rustc_mir_transform/src | |
| parent | 89d8e3116ccb7f55760825b731de4f4e0fd76770 (diff) | |
| parent | 81d7069e342fe506baa2a8431a975ec63e9b9713 (diff) | |
| download | rust-e9f95949138125bb1b98ed213a41b9aa825bacf5.tar.gz rust-e9f95949138125bb1b98ed213a41b9aa825bacf5.zip | |
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`
Diffstat (limited to 'compiler/rustc_mir_transform/src')
| -rw-r--r-- | compiler/rustc_mir_transform/src/inline.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs index 2009539d4d0..36546a03cdf 100644 --- a/compiler/rustc_mir_transform/src/inline.rs +++ b/compiler/rustc_mir_transform/src/inline.rs @@ -421,6 +421,10 @@ impl<'tcx> Inliner<'tcx> { callee_attrs: &CodegenFnAttrs, cross_crate_inlinable: bool, ) -> Result<(), &'static str> { + if self.tcx.has_attr(callsite.callee.def_id(), sym::rustc_no_mir_inline) { + return Err("#[rustc_no_mir_inline]"); + } + if let InlineAttr::Never = callee_attrs.inline { return Err("never inline hint"); } |
