summaryrefslogtreecommitdiffstats
path: root/tests/ui/traits/new-solver/temporary-ambiguity.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/traits/new-solver/temporary-ambiguity.rs')
-rw-r--r--tests/ui/traits/new-solver/temporary-ambiguity.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/traits/new-solver/temporary-ambiguity.rs b/tests/ui/traits/new-solver/temporary-ambiguity.rs
new file mode 100644
index 000000000..18ee05457
--- /dev/null
+++ b/tests/ui/traits/new-solver/temporary-ambiguity.rs
@@ -0,0 +1,22 @@
+// compile-flags: -Ztrait-solver=next
+// check-pass
+
+// Checks that we don't explode when we assemble >1 candidate for a goal.
+
+struct Wrapper<T>(T);
+
+trait Foo {}
+
+impl Foo for Wrapper<i32> {}
+
+impl Foo for Wrapper<()> {}
+
+fn needs_foo(_: impl Foo) {}
+
+fn main() {
+ let mut x = Default::default();
+ let w = Wrapper(x);
+ needs_foo(w);
+ x = 1;
+ drop(x);
+}