diff options
| author | Martin Zacho <hi@martinzacho.net> | 2025-01-08 19:56:21 +0100 |
|---|---|---|
| committer | Martin Zacho <hi@martinzacho.net> | 2025-01-08 20:04:24 +0100 |
| commit | 4b81c5beb19fa273fe5690bfc5d531b73e87b542 (patch) | |
| tree | 01373ae93e0c8c41e032801a6f5194f0cbbd4052 | |
| parent | 66c9a59a144658566cdc1292b9cc9da2fa85edf3 (diff) | |
add test from #114192
| -rw-r--r-- | tests/ui/consts/recursive-const-in-impl.rs | 12 | ||||
| -rw-r--r-- | tests/ui/consts/recursive-const-in-impl.stderr | 11 |
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/ui/consts/recursive-const-in-impl.rs b/tests/ui/consts/recursive-const-in-impl.rs new file mode 100644 index 00000000000..93f7201f921 --- /dev/null +++ b/tests/ui/consts/recursive-const-in-impl.rs @@ -0,0 +1,12 @@ +//@ build-fail +#![recursion_limit = "7"] + +struct Thing<T>(T); + +impl<T> Thing<T> { + const X: usize = Thing::<Option<T>>::X; +} + +fn main() { + println!("{}", Thing::<i32>::X); //~ ERROR: queries overflow the depth limit! +} diff --git a/tests/ui/consts/recursive-const-in-impl.stderr b/tests/ui/consts/recursive-const-in-impl.stderr new file mode 100644 index 00000000000..6175112c8cc --- /dev/null +++ b/tests/ui/consts/recursive-const-in-impl.stderr @@ -0,0 +1,11 @@ +error: queries overflow the depth limit! + --> $DIR/recursive-const-in-impl.rs:11:14 + | +LL | println!("{}", Thing::<i32>::X); + | ^^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "14"]` attribute to your crate (`recursive_const_in_impl`) + = note: query depth increased by 9 when simplifying constant for the type system `main::promoted[1]` + +error: aborting due to 1 previous error + |
