summary refs log tree commit diff
path: root/tests/ui/recursion
diff options
context:
space:
mode:
authorCaio <c410.f3r@gmail.com>2024-04-21 15:43:43 -0300
committerCaio <c410.f3r@gmail.com>2024-04-21 15:43:43 -0300
commit3aaa3941fd62fb4aeea559eafe8a6aa6472eb87d (patch)
tree370d74ef8239f923cae41848afd9e71648850de3 /tests/ui/recursion
parentfecb7b43093e4fa59e2d366e88bf0085ce350f29 (diff)
downloadrust-3aaa3941fd62fb4aeea559eafe8a6aa6472eb87d.tar.gz
rust-3aaa3941fd62fb4aeea559eafe8a6aa6472eb87d.zip
Move some tests
Diffstat (limited to 'tests/ui/recursion')
-rw-r--r--tests/ui/recursion/issue-23122-1.rs14
-rw-r--r--tests/ui/recursion/issue-23122-1.stderr9
-rw-r--r--tests/ui/recursion/issue-23122-2.rs15
-rw-r--r--tests/ui/recursion/issue-23122-2.stderr18
4 files changed, 56 insertions, 0 deletions
diff --git a/tests/ui/recursion/issue-23122-1.rs b/tests/ui/recursion/issue-23122-1.rs
new file mode 100644
index 00000000000..7fe0900ed5f
--- /dev/null
+++ b/tests/ui/recursion/issue-23122-1.rs
@@ -0,0 +1,14 @@
+trait Next {
+    type Next: Next;
+}
+
+struct GetNext<T: Next> {
+    t: T,
+}
+
+impl<T: Next> Next for GetNext<T> {
+    type Next = <GetNext<T> as Next>::Next;
+    //~^ ERROR overflow evaluating the requirement
+}
+
+fn main() {}
diff --git a/tests/ui/recursion/issue-23122-1.stderr b/tests/ui/recursion/issue-23122-1.stderr
new file mode 100644
index 00000000000..c432a502c13
--- /dev/null
+++ b/tests/ui/recursion/issue-23122-1.stderr
@@ -0,0 +1,9 @@
+error[E0275]: overflow evaluating the requirement `<GetNext<T> as Next>::Next == _`
+  --> $DIR/issue-23122-1.rs:10:17
+   |
+LL |     type Next = <GetNext<T> as Next>::Next;
+   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/recursion/issue-23122-2.rs b/tests/ui/recursion/issue-23122-2.rs
new file mode 100644
index 00000000000..2880b956417
--- /dev/null
+++ b/tests/ui/recursion/issue-23122-2.rs
@@ -0,0 +1,15 @@
+//@ normalize-stderr-test: "long-type-\d+" -> "long-type-hash"
+trait Next {
+    type Next: Next;
+}
+
+struct GetNext<T: Next> {
+    t: T,
+}
+
+impl<T: Next> Next for GetNext<T> {
+    type Next = <GetNext<T::Next> as Next>::Next;
+    //~^ ERROR overflow evaluating the requirement
+}
+
+fn main() {}
diff --git a/tests/ui/recursion/issue-23122-2.stderr b/tests/ui/recursion/issue-23122-2.stderr
new file mode 100644
index 00000000000..10463ab2c33
--- /dev/null
+++ b/tests/ui/recursion/issue-23122-2.stderr
@@ -0,0 +1,18 @@
+error[E0275]: overflow evaluating the requirement `<<<<<<<... as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next: Sized`
+  --> $DIR/issue-23122-2.rs:11:17
+   |
+LL |     type Next = <GetNext<T::Next> as Next>::Next;
+   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_23122_2`)
+note: required for `GetNext<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<T as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next>` to implement `Next`
+  --> $DIR/issue-23122-2.rs:10:15
+   |
+LL | impl<T: Next> Next for GetNext<T> {
+   |      -        ^^^^     ^^^^^^^^^^
+   |      |
+   |      unsatisfied trait bound introduced here
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0275`.