]> git.lizzy.rs Git - rust.git/blob - tests/mir-opt/inline/inline_cycle_generic.rs
Rollup merge of #106644 - alexcrichton:update-wasi-toolchain, r=cuviper
[rust.git] / tests / mir-opt / inline / inline_cycle_generic.rs
1 // Check that inliner handles various forms of recursion and doesn't fall into
2 // an infinite inlining cycle. The particular outcome of inlining is not
3 // crucial otherwise.
4 //
5 // Regression test for issue #78573.
6
7 // EMIT_MIR inline_cycle_generic.main.Inline.diff
8 fn main() {
9     <C as Call>::call();
10 }
11
12 pub trait Call {
13     fn call();
14 }
15
16 pub struct A;
17 pub struct B<T>(T);
18 pub struct C;
19
20 impl Call for A {
21     #[inline]
22     fn call() {
23         <B<C> as Call>::call()
24     }
25 }
26
27
28 impl<T: Call> Call for B<T> {
29     #[inline]
30     fn call() {
31         <T as Call>::call()
32     }
33 }
34
35 impl Call for C {
36     #[inline]
37     fn call() {
38         <B<A> as Call>::call()
39     }
40 }