Skip to content

Commit cd69787

Browse files
committed
Don't consider for inlining local functions in debug profile
1 parent e65665f commit cd69787

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

compiler/rustc_mir_transform/src/inline.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,13 @@ impl<'tcx> Inliner<'tcx> {
357357
) -> Result<(), &'static str> {
358358
match callee_attrs.inline {
359359
InlineAttr::Never => return Err("never inline hint"),
360-
InlineAttr::Always => {}
360+
InlineAttr::Always => {
361+
if self.tcx.sess.mir_opt_level() == 1 && callsite.callee.def_id().is_local() {
362+
return Err("local function and mir_opt_level() == 1");
363+
} else {
364+
// Proceed
365+
}
366+
}
361367
_ => {
362368
if self.tcx.sess.mir_opt_level() == 1 {
363369
return Err("No inline(always) and mir_opt_level() == 1");

0 commit comments

Comments
 (0)