Skip to content

Commit e65665f

Browse files
committed
Try to really read only #[inline(always)] MIR bodies (but not others)
1 parent 796cafe commit e65665f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

compiler/rustc_mir_transform/src/inline.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,16 @@ impl<'tcx> Inliner<'tcx> {
355355
callsite: &CallSite<'tcx>,
356356
callee_attrs: &CodegenFnAttrs,
357357
) -> Result<(), &'static str> {
358-
if let InlineAttr::Never = callee_attrs.inline {
359-
return Err("never inline hint");
358+
match callee_attrs.inline {
359+
InlineAttr::Never => return Err("never inline hint"),
360+
InlineAttr::Always => {}
361+
_ => {
362+
if self.tcx.sess.mir_opt_level() == 1 {
363+
return Err("No inline(always) and mir_opt_level() == 1");
364+
} else {
365+
// Proceed
366+
}
367+
}
360368
}
361369

362370
// Only inline local functions if they would be eligible for cross-crate

0 commit comments

Comments
 (0)