Skip to content

Commit 4b81c5b

Browse files
committed
add test from #114192
1 parent 66c9a59 commit 4b81c5b

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

Diff for: tests/ui/consts/recursive-const-in-impl.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//@ build-fail
2+
#![recursion_limit = "7"]
3+
4+
struct Thing<T>(T);
5+
6+
impl<T> Thing<T> {
7+
const X: usize = Thing::<Option<T>>::X;
8+
}
9+
10+
fn main() {
11+
println!("{}", Thing::<i32>::X); //~ ERROR: queries overflow the depth limit!
12+
}

Diff for: tests/ui/consts/recursive-const-in-impl.stderr

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error: queries overflow the depth limit!
2+
--> $DIR/recursive-const-in-impl.rs:11:14
3+
|
4+
LL | println!("{}", Thing::<i32>::X);
5+
| ^^^^
6+
|
7+
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "14"]` attribute to your crate (`recursive_const_in_impl`)
8+
= note: query depth increased by 9 when simplifying constant for the type system `main::promoted[1]`
9+
10+
error: aborting due to 1 previous error
11+

0 commit comments

Comments
 (0)