about summary refs log tree commit diff
path: root/tests/ui/traits/issue-90662-projection-caching.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/traits/issue-90662-projection-caching.rs')
-rw-r--r--tests/ui/traits/issue-90662-projection-caching.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/ui/traits/issue-90662-projection-caching.rs b/tests/ui/traits/issue-90662-projection-caching.rs
new file mode 100644
index 00000000000..879f30071bf
--- /dev/null
+++ b/tests/ui/traits/issue-90662-projection-caching.rs
@@ -0,0 +1,34 @@
+// check-pass
+
+// Regression test for issue #90662
+// Tests that projection caching does not cause a spurious error
+
+trait HasProvider<T: ?Sized> {}
+trait Provider<M> {
+    type Interface: ?Sized;
+}
+
+trait Repository {}
+trait Service {}
+
+struct DbConnection;
+impl<M> Provider<M> for DbConnection {
+    type Interface = DbConnection;
+}
+
+struct RepositoryImpl;
+impl<M: HasProvider<DbConnection>> Provider<M> for RepositoryImpl {
+    type Interface = dyn Repository;
+}
+
+struct ServiceImpl;
+impl<M: HasProvider<dyn Repository>> Provider<M> for ServiceImpl {
+    type Interface = dyn Service;
+}
+
+struct TestModule;
+impl HasProvider<<DbConnection as Provider<Self>>::Interface> for TestModule {}
+impl HasProvider<<RepositoryImpl as Provider<Self>>::Interface> for TestModule {}
+impl HasProvider<<ServiceImpl as Provider<Self>>::Interface> for TestModule {}
+
+fn main() {}