about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAaron Hill <aa1ronham@gmail.com>2021-12-17 10:27:26 -0500
committerAaron Hill <aa1ronham@gmail.com>2021-12-17 17:00:03 -0500
commiteee09ec4263ac13d94e79b92bdd7df780330077a (patch)
tree4cbcfddaad3cf27bc316ae396430689d14719323 /src
parent34dc0d0f249a33fda18755991b4e73ad786d2b19 (diff)
downloadrust-eee09ec4263ac13d94e79b92bdd7df780330077a.tar.gz
rust-eee09ec4263ac13d94e79b92bdd7df780330077a.zip
Remove 'speculative evaluation' of predicates
Performing 'speculative evaluation' introduces caching bugs that
cannot be fixed without invasive changes to projection.

Hopefully, we can win back most of the performance lost by
re-adding 'cache completion'

Fixes #90662
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/traits/issue-90662-projection-caching.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/test/ui/traits/issue-90662-projection-caching.rs b/src/test/ui/traits/issue-90662-projection-caching.rs
new file mode 100644
index 00000000000..879f30071bf
--- /dev/null
+++ b/src/test/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() {}