#[optimize(none)] implies #[inline(never)] by clubby789 · Pull Request #136358 · rust-lang/rust (original) (raw)

The problem is that before applying an optimization, we check the body we're optimizing to see if optimization is disabled. However, in this case

fn foo() { bar(); }

#[optimize(none)] fn bar() {}

We're applying the inlining optimization to foo, which is valid. As this is an interprocedural opt, we need to check the callee to check if it shouldn't be inlined (this is also how #[inline(never)] is handled just above