about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMartin Zacho <hi@martinzacho.net>2025-01-06 17:54:59 +0100
committerMartin Zacho <hi@martinzacho.net>2025-01-06 17:54:59 +0100
commit45f198197b5742c347311c2457be5e23ecbaec33 (patch)
treebbb976fe883e57d45df262a96fc2e4075a064722
parent38e10e56198759b37595c48c43441a3cafa390a4 (diff)
downloadrust-45f198197b5742c347311c2457be5e23ecbaec33.tar.gz
rust-45f198197b5742c347311c2457be5e23ecbaec33.zip
add test from #125718
-rw-r--r--tests/ui/consts/recursive-block.rs7
-rw-r--r--tests/ui/consts/recursive-block.stderr11
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/consts/recursive-block.rs b/tests/ui/consts/recursive-block.rs
new file mode 100644
index 00000000000..a3dcaa42836
--- /dev/null
+++ b/tests/ui/consts/recursive-block.rs
@@ -0,0 +1,7 @@
+const fn foo<T>() {
+    const { foo::<&T>() } //~ ERROR: queries overflow the depth limit!
+}
+
+fn main () {
+    const X: () = foo::<i32>();
+}
diff --git a/tests/ui/consts/recursive-block.stderr b/tests/ui/consts/recursive-block.stderr
new file mode 100644
index 00000000000..90814e2e000
--- /dev/null
+++ b/tests/ui/consts/recursive-block.stderr
@@ -0,0 +1,11 @@
+error: queries overflow the depth limit!
+  --> $DIR/recursive-block.rs:2:11
+   |
+LL |     const { foo::<&T>() }
+   |           ^^^^^^^^^^^^^^^
+   |
+   = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursive_block`)
+   = note: query depth increased by 1 when computing layout of `foo<&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&i32>`
+
+error: aborting due to 1 previous error
+