summaryrefslogtreecommitdiffstats
path: root/tests/ui/impl-trait/issues/issue-49376.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/impl-trait/issues/issue-49376.rs')
-rw-r--r--tests/ui/impl-trait/issues/issue-49376.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/issues/issue-49376.rs b/tests/ui/impl-trait/issues/issue-49376.rs
new file mode 100644
index 000000000..e4472fcc1
--- /dev/null
+++ b/tests/ui/impl-trait/issues/issue-49376.rs
@@ -0,0 +1,23 @@
+// check-pass
+
+// Tests for nested self-reference which caused a stack overflow.
+
+use std::fmt::Debug;
+use std::ops::*;
+
+fn gen() -> impl PartialOrd + PartialEq + Debug { }
+
+struct Bar {}
+trait Foo<T = Self> {}
+trait FooNested<T = Option<Self>> {}
+impl Foo for Bar {}
+impl FooNested for Bar {}
+
+fn foo() -> impl Foo + FooNested {
+ Bar {}
+}
+
+fn test_impl_ops() -> impl Add + Sub + Mul + Div { 1 }
+fn test_impl_assign_ops() -> impl AddAssign + SubAssign + MulAssign + DivAssign { 1 }
+
+fn main() {}