about summary refs log tree commit diff
path: root/tests/incremental
diff options
context:
space:
mode:
authorMichael Baikov <manpacket@gmail.com>2024-06-13 08:27:21 -0400
committerMichael Baikov <manpacket@gmail.com>2024-06-19 07:21:41 -0400
commitdb5ed4bd799cda1217ec6431ffa56cecd09ef6e9 (patch)
tree3d95e8d876a4389bfcb9e8ae07a95ca1be53dffa /tests/incremental
parent3c0f019b3c56c1a0e6e0cbed6f8a8b0b245e5665 (diff)
Allow for try_force_from_dep_node to fail
The way it is implemented currently try_force_from_dep_node returns true
as long as there's a function to force the query. It wasn't this way
from the beginning, earlier version was producing forcing result and it
was changed in https://github.com/rust-lang/rust/pull/89978, I couldn't
find any comments addressing this change.

One way it can fail is by failing to recover the query in
DepNodeParams::recover - when we are trying to query something that no
longer exists in the current environment
Diffstat (limited to 'tests/incremental')
-rw-r--r--tests/incremental/unrecoverable_query.rs40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/incremental/unrecoverable_query.rs b/tests/incremental/unrecoverable_query.rs
new file mode 100644
index 00000000000..e17236bebd2
--- /dev/null
+++ b/tests/incremental/unrecoverable_query.rs
@@ -0,0 +1,40 @@
+// If it is impossible to find query arguments just from the hash
+// compiler should treat the node as red
+
+// In this test prior to fixing compiler was having problems figuring out
+// drop impl for T inside of m
+
+//@ revisions:cfail1 cfail2
+//@ compile-flags: --crate-type=lib
+//@ build-pass
+
+pub trait P {
+    type A;
+}
+
+struct S;
+
+impl P for S {
+    type A = C;
+}
+
+struct T<D: P>(D::A, Z<D>);
+
+struct Z<D: P>(D::A, String);
+
+impl<D: P> T<D> {
+    pub fn i() -> Self {
+        loop {}
+    }
+}
+
+enum C {
+    #[cfg(cfail1)]
+    Up(()),
+    #[cfg(cfail2)]
+    Lorry(()),
+}
+
+pub fn m() {
+    T::<S>::i();
+}