Skip to content

Commit

Permalink
Try to really read only #[inline(always)] MIR bodies (but not others)
Browse files Browse the repository at this point in the history
  • Loading branch information
vlad20012 committed Apr 20, 2023
1 parent 796cafe commit e65665f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions compiler/rustc_mir_transform/src/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,16 @@ impl<'tcx> Inliner<'tcx> {
callsite: &CallSite<'tcx>,
callee_attrs: &CodegenFnAttrs,
) -> Result<(), &'static str> {
if let InlineAttr::Never = callee_attrs.inline {
return Err("never inline hint");
match callee_attrs.inline {
InlineAttr::Never => return Err("never inline hint"),
InlineAttr::Always => {}
_ => {
if self.tcx.sess.mir_opt_level() == 1 {
return Err("No inline(always) and mir_opt_level() == 1");
} else {
// Proceed
}
}
}

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

0 comments on commit e65665f

Please sign in to comment.