about summary refs log tree commit diff
path: root/tests/ui/impl-trait/non-defining-uses/use-item-bound.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/impl-trait/non-defining-uses/use-item-bound.rs')
-rw-r--r--tests/ui/impl-trait/non-defining-uses/use-item-bound.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/non-defining-uses/use-item-bound.rs b/tests/ui/impl-trait/non-defining-uses/use-item-bound.rs
new file mode 100644
index 00000000000..36dcbacbe6f
--- /dev/null
+++ b/tests/ui/impl-trait/non-defining-uses/use-item-bound.rs
@@ -0,0 +1,25 @@
+//@ revisions: current next
+//@[next] compile-flags: -Znext-solver
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@ check-pass
+#![allow(unconditional_recursion)]
+// Regression test for trait-system-refactor-initiative#182.
+
+trait Id {
+    type This;
+}
+impl<T> Id for Vec<T> {
+    type This = Vec<T>;
+}
+fn to_assoc<T: Id>(x: T) -> <T as Id>::This {
+    todo!()
+}
+
+fn mirror<T>(x: Vec<T>) -> impl Id<This = Vec<T>> {
+    let x = to_assoc(mirror(x));
+    // `?x` equals `<opaque::<T> as Id>::This`. We need to eagerly infer the
+    // type of `?x` to prevent this method call from resulting in an error.
+    x.len();
+    x
+}
+fn main() {}