about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/associated-type-bounds/all-generics-lookup.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/ui/associated-type-bounds/all-generics-lookup.rs b/tests/ui/associated-type-bounds/all-generics-lookup.rs
new file mode 100644
index 00000000000..c5940c14f44
--- /dev/null
+++ b/tests/ui/associated-type-bounds/all-generics-lookup.rs
@@ -0,0 +1,31 @@
+//@ check-pass
+
+#![feature(return_type_notation)]
+
+trait Trait {
+    fn method(&self) -> impl Sized;
+}
+
+impl Trait for () {
+    fn method(&self) -> impl Sized {}
+}
+
+struct Struct<T>(T);
+
+// This test used to fail a debug assertion since we weren't resolving the item
+// for `T::method(..)` correctly, leading to two bound vars being given the
+// index 0. The solution is to look at both generics of `test` and its parent impl.
+
+impl<T> Struct<T>
+where
+    T: Trait,
+{
+    fn test()
+    where
+        T::method(..): Send
+    {}
+}
+
+fn main() {
+    Struct::<()>::test();
+}