From 4e8199b572f2035b7749cba276ece3a26630d23e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:18:21 +0200 Subject: Adding upstream version 1.67.1+dfsg1. Signed-off-by: Daniel Baumann --- src/test/mir-opt/inline/inline_cycle_generic.rs | 40 +++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/test/mir-opt/inline/inline_cycle_generic.rs (limited to 'src/test/mir-opt/inline/inline_cycle_generic.rs') diff --git a/src/test/mir-opt/inline/inline_cycle_generic.rs b/src/test/mir-opt/inline/inline_cycle_generic.rs new file mode 100644 index 000000000..24b4f3793 --- /dev/null +++ b/src/test/mir-opt/inline/inline_cycle_generic.rs @@ -0,0 +1,40 @@ +// 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. + +// EMIT_MIR inline_cycle_generic.main.Inline.diff +fn main() { + ::call(); +} + +pub trait Call { + fn call(); +} + +pub struct A; +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() { + as Call>::call() + } +} -- cgit v1.2.3