about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tests/ui/traits/next-solver/cycles/coinduction/only-one-coinductive-step-needed.current.stderr17
-rw-r--r--tests/ui/traits/next-solver/cycles/coinduction/only-one-coinductive-step-needed.rs26
2 files changed, 43 insertions, 0 deletions
diff --git a/tests/ui/traits/next-solver/cycles/coinduction/only-one-coinductive-step-needed.current.stderr b/tests/ui/traits/next-solver/cycles/coinduction/only-one-coinductive-step-needed.current.stderr
new file mode 100644
index 00000000000..5e8e2ece54d
--- /dev/null
+++ b/tests/ui/traits/next-solver/cycles/coinduction/only-one-coinductive-step-needed.current.stderr
@@ -0,0 +1,17 @@
+error[E0275]: overflow evaluating the requirement `Foo<T>: SendIndir`
+  --> $DIR/only-one-coinductive-step-needed.rs:9:15
+   |
+LL | struct Foo<T>(<Foo<T> as Trait>::Assoc);
+   |               ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+note: required for `Foo<T>` to implement `Trait`
+  --> $DIR/only-one-coinductive-step-needed.rs:18:20
+   |
+LL | impl<T: SendIndir> Trait for T {
+   |         ---------  ^^^^^     ^
+   |         |
+   |         unsatisfied trait bound introduced here
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0275`.
diff --git a/tests/ui/traits/next-solver/cycles/coinduction/only-one-coinductive-step-needed.rs b/tests/ui/traits/next-solver/cycles/coinduction/only-one-coinductive-step-needed.rs
new file mode 100644
index 00000000000..c73189fbb08
--- /dev/null
+++ b/tests/ui/traits/next-solver/cycles/coinduction/only-one-coinductive-step-needed.rs
@@ -0,0 +1,26 @@
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
+//@[next] check-pass
+
+// #136824 changed cycles to be coinductive if they have at least
+// one productive step, causing this test to pass with the new solver.
+
+struct Foo<T>(<Foo<T> as Trait>::Assoc);
+//[current]~^ ERROR overflow evaluating the requirement `Foo<T>: SendIndir`
+
+trait SendIndir {}
+impl<T: Send> SendIndir for T {}
+
+trait Trait {
+    type Assoc;
+}
+impl<T: SendIndir> Trait for T {
+    type Assoc = ();
+}
+
+fn is_send<T: Send>() {}
+
+fn main() {
+    is_send::<Foo<u32>>();
+}