// skip-filecheck //@ compile-flags: -C debuginfo=full // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // Check that inliner handles various forms of recursion and doesn't fall into // an infinite inlining cycle. The particular outcome of inlining is not // crucial otherwise. // // Regression test for issue #78573. fn main() { one(); two(); } // EMIT_MIR inline_cycle.one.Inline.diff fn one() { ::call(); } pub trait Call { fn call(); } pub struct A(T); pub struct B(T); pub struct C; impl Call for A { #[inline] fn call() { as Call>::call() } } impl Call for B { #[inline] fn call() { ::call() } } impl Call for C { #[inline] fn call() { A::::call() } } // EMIT_MIR inline_cycle.two.Inline.diff fn two() { call(f); } #[inline] fn call(f: F) { f(); } #[inline] fn f() { call(f); }