about summary refs log tree commit diff
path: root/src/test/ui/impl-trait
diff options
context:
space:
mode:
authorJonas Schievink <jonasschievink@gmail.com>2018-10-04 14:53:16 +0200
committerJonas Schievink <jonasschievink@gmail.com>2018-10-04 14:53:16 +0200
commit7e5a13163ec0a724e67faf222d2f5b0872dc48d1 (patch)
treedfc1728710a1457fb600f09a61000879eaeb7c99 /src/test/ui/impl-trait
parent12cabc824b7fd7c94a5add3ad268e02f80749e34 (diff)
downloadrust-7e5a13163ec0a724e67faf222d2f5b0872dc48d1.tar.gz
rust-7e5a13163ec0a724e67faf222d2f5b0872dc48d1.zip
Convert issue-49376.rs to compile-pass
Diffstat (limited to 'src/test/ui/impl-trait')
-rw-r--r--src/test/ui/impl-trait/issue-49376.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/test/ui/impl-trait/issue-49376.rs b/src/test/ui/impl-trait/issue-49376.rs
new file mode 100644
index 00000000000..1dfea0b9573
--- /dev/null
+++ b/src/test/ui/impl-trait/issue-49376.rs
@@ -0,0 +1,31 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-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> {}
+impl Foo for Bar {}
+
+fn foo() -> impl Foo {
+    Bar {}
+}
+
+fn test_impl_ops() -> impl Add + Sub + Mul + Div { 1 }
+fn test_impl_assign_ops() -> impl AddAssign + SubAssign + MulAssign + DivAssign { 1 }
+
+fn main() {}