summaryrefslogtreecommitdiffstats
path: root/tests/ui/infinite/infinite-struct.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/infinite/infinite-struct.rs')
-rw-r--r--tests/ui/infinite/infinite-struct.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/ui/infinite/infinite-struct.rs b/tests/ui/infinite/infinite-struct.rs
new file mode 100644
index 000000000..f08e10f6b
--- /dev/null
+++ b/tests/ui/infinite/infinite-struct.rs
@@ -0,0 +1,16 @@
+struct Take(Take);
+//~^ ERROR has infinite size
+
+// check that we don't hang trying to find the tail of a recursive struct (#79437)
+fn foo() -> Take {
+ Take(loop {})
+}
+
+// mutually infinite structs
+struct Foo { //~ ERROR has infinite size
+ x: Bar<Foo>,
+}
+
+struct Bar<T>([T; 1]);
+
+fn main() {}