about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2025-06-03 20:56:45 +0000
committerMichael Goulet <michael@errs.io>2025-06-03 20:56:45 +0000
commitf7db329e81c4501d8f70f11e8bfcc16dd2214219 (patch)
treed158efd33c19e92c1aadfdb1463364beac48188d /tests
parentaae43c4532690153af7465227816c93036bb1604 (diff)
downloadrust-f7db329e81c4501d8f70f11e8bfcc16dd2214219.tar.gz
rust-f7db329e81c4501d8f70f11e8bfcc16dd2214219.zip
Add a test to reproduce ICE
Diffstat (limited to 'tests')
-rw-r--r--tests/incremental/print-dep-node-cycle.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/incremental/print-dep-node-cycle.rs b/tests/incremental/print-dep-node-cycle.rs
new file mode 100644
index 00000000000..931d3da521e
--- /dev/null
+++ b/tests/incremental/print-dep-node-cycle.rs
@@ -0,0 +1,25 @@
+//@ compile-flags: -Z query-dep-graph
+//@ revisions: rpass1
+
+// Exercises a debug-assertions-only query cycle that when printing a valtree const in
+// a dep node's debug representation, we end up invoking a query that also has a valtree
+// const in its dep node's debug representation, which leads to a cycle (and ICE, since
+// deps are not tracked when printing dep nodes' debug representations).
+
+#![feature(adt_const_params)]
+
+use std::marker::ConstParamTy;
+
+#[derive(Debug, ConstParamTy, PartialEq, Eq)]
+enum Foo {
+    A1,
+}
+
+#[inline(never)]
+fn hello<const F: Foo>() {
+    println!("{:#?}", F);
+}
+
+fn main() {
+    hello::<{ Foo::A1 }>();
+}