about summary refs log tree commit diff
path: root/tests/ui/traits/next-solver/global-cache-and-parallel-frontend.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/traits/next-solver/global-cache-and-parallel-frontend.rs')
-rw-r--r--tests/ui/traits/next-solver/global-cache-and-parallel-frontend.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/ui/traits/next-solver/global-cache-and-parallel-frontend.rs b/tests/ui/traits/next-solver/global-cache-and-parallel-frontend.rs
new file mode 100644
index 00000000000..2b4f7ba9fa2
--- /dev/null
+++ b/tests/ui/traits/next-solver/global-cache-and-parallel-frontend.rs
@@ -0,0 +1,27 @@
+//@ compile-flags: -Zthreads=16
+
+// original issue: https://github.com/rust-lang/rust/issues/129112
+// Previously, the "next" solver asserted that each successful solution is only obtained once.
+// This test exhibits a repro that, with next-solver + -Zthreads, triggered that old assert.
+// In the presence of multithreaded solving, it's possible to concurrently evaluate things twice,
+// which leads to replacing already-solved solutions in the global solution cache!
+// We assume this is fine if we check to make sure they are solved the same way each time.
+
+// This test only nondeterministically fails but that's okay, as it will be rerun by CI many times,
+// so it should almost always fail before anything is merged. As other thread tests already exist,
+// we already face this difficulty, probably. If we need to fix this by reducing the error margin,
+// we should improve compiletest.
+
+#[derive(Clone, Eq)] //~ ERROR [E0277]
+pub struct Struct<T>(T);
+
+impl<T: Clone, U> PartialEq<U> for Struct<T>
+where
+    U: Into<Struct<T>> + Clone
+{
+    fn eq(&self, _other: &U) -> bool {
+        todo!()
+    }
+}
+
+fn main() {}