rust/tests/mir-opt/inline/cycle.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
566 B
Rust
Raw Normal View History

// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ compile-flags: -Zinline-mir-hint-threshold=1000 -C debuginfo=full
// EMIT_MIR cycle.f.Inline.diff
2020-12-29 10:21:52 -06:00
#[inline(always)]
fn f(g: impl Fn()) {
2023-10-20 13:11:22 -05:00
// CHECK-LABEL: fn f(
// CHECK-NOT: inlined
2020-12-29 10:21:52 -06:00
g();
}
// EMIT_MIR cycle.g.Inline.diff
2020-12-29 10:21:52 -06:00
#[inline(always)]
fn g() {
2023-10-20 13:11:22 -05:00
// CHECK-LABEL: fn g(
// CHECK-NOT: (inlined f::<fn() {main}>)
2020-12-29 10:21:52 -06:00
f(main);
}
// EMIT_MIR cycle.main.Inline.diff
2020-12-29 10:21:52 -06:00
fn main() {
2023-10-20 13:11:22 -05:00
// CHECK-LABEL: fn main(
2023-10-22 11:27:43 -05:00
// CHECK-NOT: inlined
2023-10-20 13:11:22 -05:00
// CHECK: (inlined f::<fn() {g}>)
// CHECK-NOT: inlined
2020-12-29 10:21:52 -06:00
f(g);
}