Skip to content

Commit

Permalink
add test from #114192
Browse files Browse the repository at this point in the history
  • Loading branch information
mzacho committed Jan 8, 2025
1 parent 66c9a59 commit bbb8201
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/ui/consts/recursive-const-in-impl.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//@ build-fail

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!
}
11 changes: 11 additions & 0 deletions tests/ui/consts/recursive-const-in-impl.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error: queries overflow the depth limit!
--> $DIR/recursive-const-in-impl.rs:10:14
|
LL | println!("{}", Thing::<i32>::X);
| ^^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursive_const_in_impl`)
= note: query depth increased by 130 when simplifying constant for the type system `main::promoted[1]`

error: aborting due to 1 previous error

0 comments on commit bbb8201

Please sign in to comment.